public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "wcohen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug bpf/24804] bpf code generation unable to determine type of target variable used to index global variable
Date: Thu, 11 Jul 2019 19:12:00 -0000	[thread overview]
Message-ID: <bug-24804-6586-EWidDGOTEw@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-24804-6586@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=24804

--- Comment #3 from William Cohen <wcohen at redhat dot com> ---
Took a look the verbose output of the following commands for the failing bpf
and working lkm versions:

$ stap  -p4 -vvvvv --bpf -e 'global ids; probe
kernel.function("__do_sys_fcntl"){ids[$fd]++}'  >& bpf_function_typing.log

$ stap  -vvvvv -p4  -e 'global ids; probe
kernel.trace("sys_enter"){ids[$id]++}' >& lkm_typing.log


In the failing bpf version in the output see:

focused on module '/tmp/stapvvSB1G/tracequery_kmod_1/tracequery_kmod_1_116.o'
pattern 'stapprobe_sys_enter' matches function 'stapprobe_sys_enter'
replaced $id with __tracepoint_arg_id
Rerunning the code filters.
tracepoint-based probe_20795 tracepoint='sys_enter'

Later in the bpf output see:


symbol resolution for derived-probe kernel.trace("raw_syscalls:sys_enter") /*
<- kernel.trace("sys_enter") */
      global ids is defined in chosen-tapset-file <input>
number of probes with global-variable conditions: 0
Eliding side-effect-free singleton block operator '{' at <input>:1:44
replaced {
(__global_ids[__tracepoint_arg_id])++;
} with (__global_ids[__tracepoint_arg_id])++
resolved type long to identifier 'ids' at <input>:1:45
resolved type long to operator '++' at <input>:1:53
resolved type long to identifier 'ids' at <input>:1:45
semantic error: unresolved type : identifier '$id' at <input>:1:49
   thrown from: elaborate.cxx:7391
        source: global ids; probe kernel.trace("sys_enter"){ids[$id]++}


It seems that bpf is losing typing information for __tracepoint_arg_id.  For
the lkm version see:

found parameter for tracepoint 'sys_enter': type:'long int' name:'id'
decl:'long int __tracepoint_arg_id' ok
replaced $id with __tracepoint_arg_id
Rerunning the code filters.

Then later in the lkm output:

symbol resolution for derived-probe kernel.trace("raw_syscalls:sys_enter") /*
<- kernel.trace("sys_enter") */
      local __tracepoint_arg_id is already defined
      global ids is defined in chosen-tapset-file <input>
number of probes with global-variable conditions: 0
Eliding side-effect-free singleton block operator '{' at <input>:1:44
replaced {
(__global_ids[__tracepoint_arg_id])++;
} with (__global_ids[__tracepoint_arg_id])++
resolved type long to identifier 'ids' at <input>:1:45
resolved type long to identifier '$id' at <input>:1:49
resolved type long to identifier '$id' at <input>:1:49
resolved type long to operator '++' at <input>:1:53
resolved type long to identifier 'ids' at <input>:1:45
derive-probes (location #0): end of keyword at <input>:1:1
      global ids is already defined
      local __idx0 is already defined
      local __val is already defined
resolved type long to identifier '__idx0' at <input>:2:19
resolved type long to identifier 'ids' at <input>:2:30
resolved type long to identifier '__val' at <input>:2:10
resolved type long to identifier '__idx0' at <input>:3:25
resolved type long to identifier '__val' at <input>:3:32
resolved type long to identifier 'printf' at <input>:3:1
resolved type long to identifier '__idx0' at <input>:2:19
resolved type long to identifier '__val' at <input>:2:10
deleting module_cache

-- 
You are receiving this mail because:
You are the assignee for the bug.

      parent reply	other threads:[~2019-07-11 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-11 17:43 [Bug bpf/24804] New: " wcohen at redhat dot com
2019-07-11 17:56 ` [Bug bpf/24804] " wcohen at redhat dot com
2019-07-11 18:10 ` wcohen at redhat dot com
2019-07-11 19:12 ` wcohen at redhat dot com [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=bug-24804-6586-EWidDGOTEw@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --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).