Bug 1418766 - failed to compile kernel.data() example
Summary: failed to compile kernel.data() example
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: systemtap
Version: 24
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Frank Ch. Eigler
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-02 16:42 UTC by masanari iida
Modified: 2017-02-08 01:42 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-02-08 01:42:46 UTC
Type: Bug


Attachments (Terms of Use)

Description masanari iida 2017-02-02 16:42:02 UTC
Description of problem:
Systemtap on Fedora 24(x86_64) failed to compile kernel.data() example.
Using upstream's systemtap, it works.

Version-Release number of selected component (if applicable):
systemtap-3.0-4.fc24
kernel-4.9.5-100.fc24

How reproducible:
Always.

Steps to Reproduce:
1.  The exampe script.
 
#! /usr/bin/env stap
probe kernel.data("vm_dirty_ratio").rw
{
  print_backtrace();
}

2. compile the script.

# stap -v ./dirty_ratio.stp Pass 1: parsed user script and 132 library scripts using 154672virt/64652res/7000shr/57636data kb, in 300usr/30sys/327real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 156916virt/67208res/7192shr/59880data kb, in 20usr/0sys/23real ms.
Pass 3: translated to C into "/tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c" using 157048virt/67208res/7192shr/60012data kb, in 0usr/0sys/0real ms.
In file included from /usr/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
/usr/share/systemtap/runtime/linux/access_process_vm.h: In function '__access_process_vm_':
/usr/share/systemtap/runtime/linux/access_process_vm.h:36:61: error: passing argument 6 of 'get_user_pages_remote' makes pointer from integer without a cast [-Werror=int-conversion]
    ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
                                                          ^
In file included from ./include/linux/pid_namespace.h:6:0,
                 from ./include/linux/ptrace.h:8,
                 from ./include/linux/ftrace.h:13,
                 from ./include/linux/kprobes.h:42,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
./include/linux/mm.h:1276:6: note: expected 'struct page **' but argument is of type 'int'
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
/usr/share/systemtap/runtime/linux/access_process_vm.h:36:64: error: passing argument 7 of 'get_user_pages_remote' from incompatible pointer type [-Werror=incompatible-pointer-types]
 ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
                                                          ^
In file included from ./include/linux/pid_namespace.h:6:0,
                 from ./include/linux/ptrace.h:8,
                 from ./include/linux/ftrace.h:13,
                 from ./include/linux/kprobes.h:42,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
./include/linux/mm.h:1276:6: note: expected 'struct vm_area_struct **' but argument is of type 'struct page **'
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/share/systemtap/runtime/linux/runtime.h:209:0,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
/usr/share/systemtap/runtime/linux/access_process_vm.h:36:13: error: too many arguments to function 'get_user_pages_remote'
       ret = get_user_pages_remote (tsk, mm, addr, 1, write, 1, &page, &vma);
             ^~~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/pid_namespace.h:6:0,
                 from ./include/linux/ptrace.h:8,
                 from ./include/linux/ftrace.h:13,
                 from ./include/linux/kprobes.h:42,
                 from /usr/share/systemtap/runtime/linux/runtime.h:21,
                 from /usr/share/systemtap/runtime/runtime.h:24,
                 from /tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.c:26:
./include/linux/mm.h:1276:6: note: declared here
 long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm,
      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:293: recipe for target '/tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.o' failed
make[1]: *** [/tmp/stapx8nwAX/stap_2415c6268f17cdbfbde2ca42b597704b_1032_src.o] Error 1
Makefile:1494: recipe for target '_module_/tmp/stapx8nwAX' failed
make: *** [_module_/tmp/stapx8nwAX] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_2415c6268f17cdbfbde2ca42b597704b_1032.ko" in 10940usr/1610sys/12511real ms.
Pass 4: compilation failed.  [man error::pass4]

Additional info:
With upstream systemtap,(commit 575fe913f6b6b81421f7bfda7c72ab8c15ecb8e3)
the systemtap script compile and work as expected.

# /home/iida/systemtap/bin/stap -v ./dirty_ratio.stp 
Pass 1: parsed user script and 119 library scripts using 72692virt/42000res/5028shr/37504data kb, in 180usr/10sys/195real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 73352virt/42912res/5156shr/38164data kb, in 10usr/0sys/5real ms.
Pass 3: using cached /root/.systemtap/cache/d4/stap_d41c819372acfec776748c14cfeb0134_1138.c
Pass 4: using cached /root/.systemtap/cache/d4/stap_d41c819372acfec776748c14cfeb0134_1138.ko
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d kernel'
 0xffffffffaf1cef8c
 0x0 (inexact)
 0xffffffffaf1cef8c
 0x0 (inexact)

Comment 1 David Smith 2017-02-02 16:53:56 UTC
That was probably fixed by either of the following 2 upstream commits:

====
commit 2676bba61284109b8f6f96921667613c15398a07
Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Mon Dec 26 10:39:09 2016 -0500

    Fix get_user_pages_remote() test for 4.10-rc0 kernels.
    
    This kernel API is undergoing considerable flux.

commit 00960517fb4a4d8388854b470da30e0c886b0e89
Author: David Smith <dsmith@redhat.com>
Date:   Fri Dec 9 11:41:35 2016 -0600

    Fix BZ1386120 by updating systemtap to handle the 4.9 kernel.
    
    * runtime/linux/access_process_vm.h (__access_process_vm_): Use
      STAPCONF_GET_USER_PAGES_REMOTE_FLAGS to handle get_user_pages_remote()
      kernel function API change.
    * runtime/transport/procfs.c (_stp_proc_read): Use _stp_get_rchan_subbuf()
      macro to handle kernel relayfs rchan->buf changes.
    * runtime/transport/relay_v2.c (__stp_relay_wakeup_timer): Ditto.
      (_stp_data_write_reserve): Ditto.
    * runtime/transport/symbols.c (_stp_module_panic_notifier): Ditto.
    * buildrun.cxx (compile_pass): Add autoconf-style tests.
    * runtime/linux/autoconf-get_user_pages_remote-flags.c: New file.
    * runtime/linux/autoconf-relay_buf-per_cpu_ptr.c: New file.
    * runtime/transport/relay_compat.h: New file.
====

Since Fedora 24 has switched to a 4.9 kernel, this puts additional pressure on us to get a new systemtap release out. I'll try to update this bug when we've finalized our release plans.

Comment 2 masanari iida 2017-02-08 00:21:31 UTC
After update to following version, systemtap can compie the script again.

systemtap-sdt-devel-3.1-0.20170125gite81970274b46.fc24.x86_64
systemtap-devel-3.1-0.20170125gite81970274b46.fc24.x86_64
systemtap-3.1-0.20170125gite81970274b46.fc24.x86_64
systemtap-client-3.1-0.20170125gite81970274b46.fc24.x86_64

[root@masabert kernel]# stap -v ./dirty_ratio.stp 
Pass 1: parsed user script and 138 library scripts using 157744virt/69864res/7028shr/62740data kb, in 360usr/30sys/384real ms.
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using 159988virt/72096res/7156shr/64984data kb, in 20usr/0sys/25real ms.
Pass 3: using cached /root/.systemtap/cache/fc/stap_fca4a8f062693ede3a4d82a57fc5a41f_1050.c
Pass 4: using cached /root/.systemtap/cache/fc/stap_fca4a8f062693ede3a4d82a57fc5a41f_1050.ko
Pass 5: starting run.
WARNING: Missing unwind data for a module, rerun with 'stap -d kernel'
 0xffffffffaf1cef8c

Thank you.
You may close this case.

Comment 3 Frank Ch. Eigler 2017-02-08 01:42:46 UTC
thanks for testing!


Note You need to log in before you can comment on or make changes to this bug.