Action of the brain, whether conscious or unconscious. My blogs do not necessarily have a theme or a focus. They are here, because I felt like putting it here. They could be something which I am thinking about, something which I want to talk to someone about, something which I am working on or want to share. In short they are my feelings, opinions, work and good things I want to share.
Saturday, April 24, 2010
Saturday, April 17, 2010
LKML Summary Podcast – A semi-daily summary of LKML traffic
kernelpodcast.org provides a semi-daily summary of email traffic on the Linux Kernel Mailing List (LKML) in the form of a podcast and audio transcripts. It was started by Jon Masters as a means to force himself to keep up with the LKML.
Friday, April 16, 2010
Monday, April 05, 2010
Calling a C function from Assembly
Recently I had a requirement of having to call a C function from assembly (in the Linux kernel). One might wonder why someone would have to call a C function from assembly. Well… the reason is I wanted a dump of registers before I put the processor (OMAP) to sleep. The sleep code in Linux is written in assembly and I wanted the dump in a place just before the final call (to sleep) is made. Writing an assembly routine would be too difficult.
I could have taken a dump before the code jumped to assembly and then followed the assembly code to see what changes are being made to which register to arrive at the register values before the processor is put to sleep. In fact I did that in my initial investigation. I could have also stored the values of the registers in a place in memory and printed them once the code gets back to C. However, I wanted to find a way to call a C function from assembly because that seemed very challenging and moreover, why should we make life difficult (by writing code in assembly) when we have a high level language to solve our problems.
I am not going deep in to the details of what all I tried, but here is what I did finally.
ARM’s SWI (software interrupts) instructions are used to execute system calls. On execution of the SWI instruction, the control is transferred to the kernel and depending on the number (which is part of the SWI instruction), the kernel executes the appropriate SWI handler (a system call). I used this method to call a system call of my own, which I used to dump the registers. The SWI instruction is a simple assembly instruction (something like swi 0x00900142).
I know that implementing a new system call for such small things is not recommended, but this was mainly for debugging an issue. This is not going to be part of any distribution.
More details about implementing a system call can be found by Googling.
Friday, March 26, 2010
Debugging early boot problems in Linux
Got this from Here. Posting only the portion I was interested in.
Accessing the printk buffer after a silent hang on boot.
This can also be useful when we are debugging the power management (that’s what I was doing when I wrote this).
Sometimes, if the kernel hangs early in the boot process, you get no messages on the console before the hang. Sometimes it's just "Uncompressing Linux.......". That's it.
However, there may still be messages in the printk buffer, which can give you an idea of where the problem is. The kernel starts putting messages into the printk buffer as soon as it starts. They stay buffered there until the console code has a chance to initialize the console device (often the serial port for embedded devices). Even though these messages are not printed before the hang, it is still possible in some circumstances to dump the printk buffer and see the messages.
When the kernel crashes as soon as it starts booting without any prints then its possible to dump the printk buffer from the boot loader. To do it you have to know how your boot loader maps memory compared to the kernel.
U-boot example on an OMAP OSK based board
When the kernel crashes, reset the board and drop to the boot loader prompt. Its important that you don't power cycle the board.
In the source tree of the compiled kernel which just crashed do
| grep __log_buf System.map |
or
| grep __log_buf /proc/kallsyms |
This showed
| $ grep __log_buf System.map |
In our case, this address maps to 0x101eca94. So I reset the target board and use the following:
| OMAP5912 OSK # md 0x101eca94 |
Similarly, the following steps shows the printk buffer (usually what got printed just before reset)
| grep printk_buf System.map |
this shows the linked address of the printk_buf, e.g.:
| c01ec5f4 b printk_buf.5 |
The address "c01ec5f4 " is in kernel virtual. Find the physical address mapping of it. So, after resetting the target board, but without letting it try to boot again, at the boot loader prompt
| OMAP5912 OSK # md 101ec5f4 |
And you see the printk buffer that never got flushed to the UART. Knowing what's there can be very useful in debugging.
Wednesday, July 15, 2009
Top Posting :-)
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Tuesday, June 16, 2009
Thursday, June 11, 2009
Love ...
I once had a friend who grew to be very close to me. Once when we were sitting at the edge of a swimming pool, she filled the palm of her hand with some water and held it before me, and said this: "You see this water carefully contained on my hand? It symbolizes Love."
This was how I saw it: As long as you keep your hand caringly open and allow it to remain there, it will always be there. However, if you attempt to close your fingers round it and try to possess it, it will spill through the first cracks it finds.This is the greatest mistake that people do when they meet love...they try to possess it, they demand, they expect... and just like the latter spilling out of your hand, love will retrace from you .
For love is meant to be free, you cannot change its nature. If there are people you love, allow them to be free beings.
1. Give and don't expect.
2. Advise, but don't order.
3. Ask, but never demand.
It might sound simple, but it is a lesson that may take a lifetime to truly practice. It is the secret to true love. To truly practice it, you must sincerely feel no expectations from those who you love, and yet an unconditional caring."
Monday, February 16, 2009
Hmmmm.....
[ Saw this somewhere and my current stage in life makes it more meaningful for me ]
Tuesday, December 02, 2008
Just for fun
/*
* linux/lib/vsprintf.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
/*
* Wirzenius wrote this portably, Torvalds fucked it up :-)
*/
Friday, October 31, 2008
Ever wondered how Google makes street views
Google Mail Goggle
For quite some years now I have adopted a strategy to prevent that from happening. If I ever had to send such a mail to someone, I compose the mail and save as draft at night and wait till the next day morning to send it. My subconscious mind thinks about it and helps me decide if I should really send that mail or not. During that gap either my anger comes down or I will be in a position to comprehend the situation more clearly. In quite a few cases, I have discarded that mail and in some cases I have changed certain words and sent it.
Thanks to Google for coming up with this Mail Goggle. Read more to find yourself what it does. I guess that small amount of time we spend before sending mails helps to save relations.
Thursday, November 01, 2007
Are We...?
Are we too arrogant to start small?
Are we too knowledgeable to really listen or learn?
Are we too self-centered to relinquish authorship or control?
Are we too cynical to trust people?
Are we too egotistical to admit error?
Are we too insecure to try really different things?
Are we too myopic to make history?
[Take from the slides presented at XLRI by Ingrid Srinath, CEO of CRY]
Thursday, August 30, 2007
Kernel in full swing
Here is the result of the size's of the kenrel tree
Size of the kernel downloaded (tar.bz2): 44 MB
Size of Uncompiled (clean) kernel tree: 294 MB
Size of the compiled kernel tree: 4.5 GB
Size of vmlinux generated: 442 MB
Size of the bzImage: 16 MB
I ended up clearing most of the unwanted things in my home directory trying to make space for the compilation :-)
Wednesday, July 18, 2007
Friday, June 08, 2007
What to learn from scientific/technical education
"The most valuable acquisition in a scientific or technical education are the general-purpose mental tools which remain serviceable for a lifetime. I rate natural language and mathematics as the most important of these tools, and computer science as a third"
From the article, "What to do till the Computer Scientist comes", American Mathematical Monthly 75 (1968), 454-462
Source: "Selected papers on computer science - Donald Knuth"
I always believed that, if we teach a language and mathematics to students, then its as good as teaching him/her all other subjects. I was happy to see that there are other people in the world who also hold that opinion.
More info on this article may be got at
http://infolab.stanford.edu/TR/CS-TR-67-77.html
The complete article may be downloaded from
ftp://reports.stanford.edu/pub/cstr/reports/cs/tr/67/77/CS-TR-67-77.pdf
Monday, October 02, 2006
Swami Vivekananda's speech in his own voice? I don't think so.
Those recordings are not genuine. I am not commenting on the subject that has been recorded (I don't even think that I am eligible to do so), but I am saying that the voice is not of Swami Vivekananda. I say this because I enquired about these recordings with a Monk of the Ramkrishna Order who is the editor of one of the magazines brought out by Ramakrishna Math. The views and opinions expressed here are my own.
There were no sophisticated recording devices when Swamiji spoke at the Parliament of religions. The diary written during the Parliament of religions (Ref: "Swami Vivekananda in The West - New Discoveries, Volume 1", Page:76, Publishers: Advaita Ashram, Calcutta) by the organizers says that stenographers were hired to take notes of the speech. If recording devices existed, then why would they hire stenographers to take notes?
There was only one recording of Swamiji's voice with the Maharaja of Mysore. It was a phonographic record (Ref: "The Life of Swami Vivekananda, by his Eastern and Western Disciples Volume 1", Page: 324 & 325. Publishers: Advaita Ashram, Calcutta). The book clearly says that the voice is now indistinct. This show the quality of recording devices that existed at that time.
The voice in these recordings is so clear that it makes anyone doubt those recordings.
In the "Complete Works of Swami Vivekananda, Volume 1", some of the words are written in square brackets. The publishers (Advaita Ashram, Calcutta) say that the stenographers were unable to record some of the words of Swamiji and so are missing in their notes and because of which the publishers have put in the missing words in square brackets that seem to complete the sentence. They clearly say in the book that those words were put in by them.
If the recordings were of Swamij's own speech, then could they not have heard them over and over and got the right words?
If its indeed the voice of Swami Vivekananda, then why has the Ramakrishna Mission or the Ramakrishna Math released any audio cassettes or audio CD's containing them? Will they not be interested in making the people listen to his voice?
These recordings are just recitation of Swamiji's work by someone else. Thanks for the effort of those trying to spread his words, no matter even if its through someone else'a voice.
Wednesday, September 27, 2006
Should I learn to spell it right ????
Monday, September 18, 2006
"I would not care much for a religion...."
Swami Vivekananda was once passing through Bengal when a forestry officer and his wife were so much impressed by his appearance that they insisted on his stopping in their house. 'The rains have just set in, Swamiji,' they said, 'this is the time when no Sannyasin tries to wander. Why do you not come and live with us for a while? We have no children and we can give you a place where you will be altogether undistured.' Swamiji consented.
'Both became his disciples and the wife took initiation from him. On the morning when he was leaving she said with some compunction: 'Swamiji, I am in the habit of drinking a cup of tea in the early morning. Will that interfere with my spirutual progress?' Swamiji replied, 'I would not care much for a religion which could be washed off by a cup of tea.'