dump per process stack in linux

I need to dump the each and every process stack in linux kernel when the system hangs.

I am currently trying to implement in one of my kernel module based on the watchdog timer timeout. Watchdog timer is reset by a user daemon for every timeslice. When the system hangs, there's no one up to reset the timer. Hence it expires and generates an interrupt. I wrote an interrupt handler where I should dump the stack of every process running.

So, my question is how can I dump stack of every process in kernel?

Thanks Venkatesh


show_state() (include/linux/sched.h) will do this for you. BTW, this function is already available from the sysrq handler, which you might be able to make use of if it's enabled. See Documentation/sysrq.txt

Also, there are some other kernel debugging options you might be able to enable to help find your problem. Check out the Kernel Hacking menu in make menuconfig. In particular, CONFIG_LOCKUP_DETECTOR ("Detect Hard and Soft Lockups" in the menu) might be helpful.

链接地址: http://www.djcxy.com/p/43624.html

上一篇: 任务交换开/关CPU运行队列的位置

下一篇: 在Linux中转储每个进程堆栈