This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: printk in kernel.function("__switch_to") probe crashes machine
- From: Jim Keniston <jkenisto at us dot ibm dot com>
- To: dcnltc at us dot ibm dot com
- Cc: systemtap at sourceware dot org
- Date: Wed, 25 Apr 2007 16:03:02 -0700
- Subject: Re: printk in kernel.function("__switch_to") probe crashes machine
- References: <462FE193.6090102@us.ibm.com>
On Wed, 2007-04-25 at 16:17 -0700, Dave Nomura wrote:
> 3. I have written a kernel function probe in __switch_to and find that I
> can define it as:
> probe kernel.function("__switch_to")
> {
> print("calling ITrace_switch\n");
> // ITrace_switch()
> }
> If I run this script I get:
> Running sudo /usr/bin/staprun -u dcn -d 3614 -c
> "/home/dcn/itrace/ITrace_test/hanoi/hanoi64 -2" /tmp/stapAiagsM/pitrace.ko
> start itrace
> calling ITrace_switch
> ....
> calling ITrace_switch
> end itrace
> and this works just as expected.
> However, if I uncomment ITrace_switch() call in my __switch_to probe,
> and define it as:
> function ITrace_switch()
> %{
> printk("ITrace_switch called\n");
> %}
> this crashes the machine.
>
> I'm a SystemTap novice, and kernel novice so I'm not sure if there is
> some obvious reason why this "printk" should cause the system to crash.
> There are no messages on the console.
>
> If there is a simple explanation I guess it might help me avoid doing
> this sort of thing in the future. For now, I'll just avoid using printk
> in this scenario.
We advise against using printk in SystemTap handlers. We know of some
functions that, if kprobed with handlers that call printk, can deadlock.
See bugzilla #3541. I wouldn't think that __switch_to() would be in
that group (since printk() doesn't block and so shouldn't call
__switch_to()), but I could be wrong.
Jim
>
> Here is the machine info:
> Linux elm3b158 2.6.16.43-0.5-ppc64 #1 SMP Mon Mar 19 08:28:24 UTC 2007
> ppc64 ppc64 ppc64 GNU/Linux
> SUSE Linux Enterprise Server 10 SP1 RC1 (ppc)
>