Bug 24923

Summary: perf_event_create_kernel_counter changed on kernel 5.2
Product: systemtap Reporter: Frank Ch. Eigler <fche>
Component: runtimeAssignee: Unassigned <systemtap>
Status: NEW ---    
Severity: normal CC: fche, info, systemtap
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on: 24904    
Bug Blocks:    

Description Frank Ch. Eigler 2019-08-21 01:39:37 UTC
It seems that there is also a problem with regard to perf_event_create_kernel_counter:

$ stap -v -e 'global s; probe timer.profile { s[backtrace()] <<< 1; } probe end { foreach (i in s+) { print_stack(i); printf("\t%d\n", @count(s[i])); } } probe timer.s(60) { exit(); }' > out.stap-stacks
Pass 1: parsed user script and 488 library scripts using 355536virt/129684res/9428shr/119992data kb, in 190usr/30sys/223real ms.
Pass 2: analyzed script: 3 probes, 7 functions, 1 embed, 1 global using 360024virt/134296res/9564shr/124480data kb, in 20usr/0sys/17real ms.
Pass 3: translated to C into "/tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c" using 360024virt/134296res/9564shr/124480data kb, in 0usr/0sys/0real ms.
In file included from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:260:
/usr/share/systemtap/runtime/stack.c:51:14: error: ‘struct stack_trace’ declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
   51 |       struct stack_trace *trace);
      |              ^~~~~~~~~~~
/usr/share/systemtap/runtime/stack.c: In function ‘_stp_stack_print_fallback’:
/usr/share/systemtap/runtime/stack.c:171:21: error: storage size of ‘trace’ isn’t known
  171 |  struct stack_trace trace;
      |                     ^~~~~
In file included from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c: In function ‘_stp_perf_init’:
/usr/share/systemtap/runtime/linux/perf.c:49:18: error: passing argument 3 of ‘perf_event_create_kernel_counter’ makes pointer from integer without a cast [-Werror=int-conversion]
   49 |              task->pid,
      |              ~~~~^~~~~
      |                  |
      |                  pid_t {aka int}
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: expected ‘struct task_struct *’ but argument is of type ‘pid_t’ {aka ‘int’}
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:44:34: error: too few arguments to function ‘perf_event_create_kernel_counter’
   44 |      stp->e.t.per_thread_event = perf_event_create_kernel_counter(&stp->attr,
      |                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: declared here
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:100:13: error: passing argument 3 of ‘perf_event_create_kernel_counter’ makes pointer from integer without a cast [-Werror=int-conversion]
  100 |             -1,
      |             ^~
      |             |
      |             int
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: expected ‘struct task_struct *’ but argument is of type ‘int’
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:1159:
/usr/share/systemtap/runtime/linux/perf.c:95:15: error: too few arguments to function ‘perf_event_create_kernel_counter’
   95 |      *event = perf_event_create_kernel_counter(&stp->attr,
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:236,
                 from /usr/share/systemtap/runtime/runtime.h:26,
                 from /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.c:28:
./include/linux/perf_event.h:899:1: note: declared here
  899 | perf_event_create_kernel_counter(struct perf_event_attr *attr,
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:278: /tmp/stapS4JOAT/stap_7a9f78085e38311a1bb8015256b67067_2952_src.o] Error 1
make: *** [Makefile:1601: _module_/tmp/stapS4JOAT] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_7a9f78085e38311a1bb8015256b67067_2952.ko" in 6780usr/1500sys/8282real ms.
Pass 4: compilation failed.  [man error::pass4]