This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: probe when thread is queued


On 02/05/2013 10:31 PM, Mehul Choube wrote:
> It still gives error:
> 
> ======= cmd out start =======
> 
> sles11sp1:/stap_scripts # stap -v -e 'probe scheduler.cpu_off { if (@cast(task_prev, "task_struct")->state == 0) { printf ("pid %d queued\n", @cast(task_prev, "task_struct")->pid); } }'
> Pass 1: parsed user script and 59 library script(s) in 100usr/0sys/104real ms.
> semantic error: not accessible at this address (0xffffffff8139499b): identifier '$prev' at /usr/share/systemtap/tapset/scheduler.stp:38:17
>         source:     task_prev = $prev
>                                 ^
> Pass 2: analyzed script: 1 probe(s), 2 function(s), 0 embed(s), 0 global(s) in 260usr/130sys/401real ms.
> Pass 2: analysis failed.  Try again with another '--vp 01' option.
> 
> ======= cmd out end =======

This is probably because the function 'context_switch' is often inlined,
and variable availability often suffers.

Both your kernel and stap versions are pretty old, but still new enough
that I think it should be able to use the tracepoint version of this
probe, which should have better variable access.  Does your kernel have
CONFIG_TRACEPOINTS=y enabled?

Another option is to note that scheduler.cpu_off runs while still in the
context of the departing thread, i.e. $prev == task_current().  So you
could use task_current() for each @cast instead.

We do have a task tapset which encapsulates the same information as
those @casts, so task_state(task_current()) will get you "->state", and
task_tid(task_current()) or even tid() will get you "->pid".  (We use
the userspace view that TID == kernel pid and PID == kernel tgid.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]