09 March 2009

kernel panic when calling printk() inside scheduler code...

An interesting question arose in kernelnewbies mailing list. Basically, somebody somebody asked why calling printk() when intercepting scheduler code (using jprobe) results in kernel panic. Full thread can be read here.

My analysis, somehow during module initialization, printk() must not be executed to avoid recursively waking up klogd. The original poster said it didn't help. Finally, he found a workaround, that is by incrementing a variable named oops_in_progress. I bet works like a flag. When it's greater than zero, it prevents klogd to wake up. Problem solved!

Note: klogd is a kernel thread that reads kernel ring buffer and send it to user space daemon syslogd if there's any entries there. Those are the messages that we see ending up in /var/log/messages (for non critical kernel messages).



08 March 2009

the way we respond to a question

Probably, you think that's easy. Listen to the question, think for a moment (or longer...if time allows) and explain your answer.

But when I looked at this blog post, I am a bit intrigued. For those who don't know who that guy is, he's Kir Kolyshkin. One of the main developer of OpenVZ, a container solution for Linux. Container is a kind of virtualization which is done in OS level. System calls are intercepted so every guest thinks he owns the whole system. But unlike User Mode Linux, OpenVZ is not using ptrace, but guest kernel is patched so system call is now routed to a "stub" in host kernel. So certainly, Kir is not average developer and far from mediocre level....

This paragraph is interesting:
"I think the talk was well received and I had about 10 different interesting questions, one is puzzling enough so I was not able to provide a good answer. This is definitely a sign of a good audience."

Most of the time, especially when some (doubtly) educated people receive tough question, he will turn into defending mode or attack the questioner back. But Kir thinks differently. He admitted he can not answer all questions, a normal thing for normal human being. And he appreciated that.

I wish this kind of attitute is something we can learn and practice in our everyday life.....



How to execute multiple commands directly as ssh argument?

 Perhaps sometimes you need to do this: ssh user@ ls It is easy understand the above: run ls after getting into via ssh. Pi...