From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11147 invoked by alias); 8 Jul 2010 14:28:29 -0000 Received: (qmail 11137 invoked by uid 22791); 8 Jul 2010 14:28:28 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD 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; Thu, 08 Jul 2010 14:28:21 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o68ESJXj013488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Jul 2010 10:28:19 -0400 Received: from [10.36.4.91] (vpn1-4-91.ams2.redhat.com [10.36.4.91]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o68ESITU011468; Thu, 8 Jul 2010 10:28:19 -0400 Subject: Re: kernel read fault when accessing context variables From: Mark Wielaard To: tonyg362 Cc: systemtap@sourceware.org In-Reply-To: <29099754.post@talk.nabble.com> References: <29099754.post@talk.nabble.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 08 Jul 2010 14:28:00 -0000 Message-ID: <1278599298.1040.18.camel@springer.wildebeest.org> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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: 2010-q3/txt/msg00029.txt.bz2 Hi Tony, On Wed, 2010-07-07 at 11:41 -0700, tonyg362 wrote: > I'm trying to access the prev/next task structs within the scheduler e.g. > > probe kernel.statement("schedule@kernel/sched.c:line#") { > ppid = $prev->tgid > npid = $npid->tgid > > printf("ppid:%d, npid:%d\n", ppid, npid) > } > > I am able access $npid->tgid just fine and it prints the correct npid, > however whenever I try to access $prev->tgid the entire probe is skipped and > I get a kernel read fault: > > focused on module 'kernel' > selected source file '/build/buildd/linux-2.6.31/kernel/sched.c' > selected function schedule > probe schedule@/build/buildd/linux-2.6.31/kernel/sched.c:5365 kernel > reloc=.dynamic section=.text pc=0xffffffff8152bc4e > finding location for local 'prev' near address 0xffffffff8152bc4e, module > bias 0x0 > [...] > ERROR: kernel read fault at 0x000000000000029d (addr) near identifier > '$prev' at test.stp:2:9 > > I've tried building my own kernel, I've tried version 2.6.28, this error > seems to persist no matter what I try. I've even tried systemtap 1.2 same > problem. I am not seeing the same thing as you, but I do also have trouble trying to grab $prev and $npid from schedule(). semantic error: not accessible at this address (0xffffffff814d7b30): identifier '$prev' at :2:12 source: ppid = $prev->tgid ^ semantic error: unable to find local 'npid' near pc 0xffffffff814d7b30 in schedule(kernel/sched.c) (alternatives: $prev $next $switch_count $rq $cpu): identifier '$npid' at :3:12 source: npid = $npid->tgid ^ It is correct about $npid, there is no argument or local variable with that name in my kernel/sched.c(schedule) function. It might be correct about $prev, it might not yet be available at the start of the function. I haven't inspected the dwarf output yet, but I assume gcc got somewhat confused here. I do notice schedule is marked with asmlinkage http://kernelnewbies.org/FAQ/asmlinkage maybe that gets gcc confused? What compiler did you use to build your kernel? Thanks, Mark