From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13138 invoked by alias); 6 Feb 2013 20:02:03 -0000 Received: (qmail 13117 invoked by uid 22791); 6 Feb 2013 20:02:02 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 06 Feb 2013 20:01:57 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r16K1ukm023858 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 6 Feb 2013 15:01:56 -0500 Received: from [10.3.113.162] (ovpn-113-162.phx2.redhat.com [10.3.113.162]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r16K1uXe030748; Wed, 6 Feb 2013 15:01:56 -0500 Message-ID: <5112B6B4.4000903@redhat.com> Date: Wed, 06 Feb 2013 20:02:00 -0000 From: Josh Stone User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Mehul Choube CC: "systemtap@sourceware.org" Subject: Re: probe when thread is queued References: <5111795F.2080703@redhat.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2013-q1/txt/msg00097.txt.bz2 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.)