This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: kernel read fault when accessing context variables
- From: Mark Wielaard <mjw at redhat dot com>
- To: tonyg362 <tonyg3622 at yahoo dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 08 Jul 2010 16:28:18 +0200
- Subject: Re: kernel read fault when accessing context variables
- References: <29099754.post@talk.nabble.com>
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 <input>: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