From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11848 invoked by alias); 11 Jul 2019 19:12:41 -0000 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 Received: (qmail 11730 invoked by uid 48); 11 Jul 2019 19:12:29 -0000 From: "wcohen at redhat dot com" 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 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: bpf X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wcohen at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2019-q3/txt/msg00013.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=3D24804 --- Comment #3 from William Cohen --- 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=3D'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 number of probes with global-variable conditions: 0 Eliding side-effect-free singleton block operator '{' at :1:44 replaced { (__global_ids[__tracepoint_arg_id])++; } with (__global_ids[__tracepoint_arg_id])++ resolved type long to identifier 'ids' at :1:45 resolved type long to operator '++' at :1:53 resolved type long to identifier 'ids' at :1:45 semantic error: unresolved type : identifier '$id' at :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 number of probes with global-variable conditions: 0 Eliding side-effect-free singleton block operator '{' at :1:44 replaced { (__global_ids[__tracepoint_arg_id])++; } with (__global_ids[__tracepoint_arg_id])++ resolved type long to identifier 'ids' at :1:45 resolved type long to identifier '$id' at :1:49 resolved type long to identifier '$id' at :1:49 resolved type long to operator '++' at :1:53 resolved type long to identifier 'ids' at :1:45 derive-probes (location #0): end of keyword at :1:1 global ids is already defined local __idx0 is already defined local __val is already defined resolved type long to identifier '__idx0' at :2:19 resolved type long to identifier 'ids' at :2:30 resolved type long to identifier '__val' at :2:10 resolved type long to identifier '__idx0' at :3:25 resolved type long to identifier '__val' at :3:32 resolved type long to identifier 'printf' at :3:1 resolved type long to identifier '__idx0' at :2:19 resolved type long to identifier '__val' at :2:10 deleting module_cache --=20 You are receiving this mail because: You are the assignee for the bug.