public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Josh Stone <jistone@redhat.com>
To: Mehul Choube <Mehul_Choube@symantec.com>
Cc: "systemtap@sourceware.org" <systemtap@sourceware.org>
Subject: Re: probe when thread is queued
Date: Wed, 06 Feb 2013 20:02:00 -0000	[thread overview]
Message-ID: <5112B6B4.4000903@redhat.com> (raw)
In-Reply-To: <E884EC9CD547324B8976A5D37317AC566D92A6BBD4@APJ1XCHEVSPIN30.SYMC.SYMANTEC.COM>

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.)

      reply	other threads:[~2013-02-06 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 20:33 Mehul Choube
2013-02-05 21:28 ` David Smith
2013-02-06  6:31   ` Mehul Choube
2013-02-06 20:02     ` Josh Stone [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5112B6B4.4000903@redhat.com \
    --to=jistone@redhat.com \
    --cc=Mehul_Choube@symantec.com \
    --cc=systemtap@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).