Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GFP_WAIT undeclared - script fails on Ubuntu 14.04 with 4.4.0-38 kernel #8

Open
mpurzynski opened this issue Oct 4, 2016 · 3 comments

Comments

@mpurzynski
Copy link

Hey,

when trying to run your script like this

stap -v histogram-kernel.stp 'kernel.function("net_rx_action")'

I've got a metric ton of errors. Do I need to change it for my kernel version? Can it be made version independent?

Pass 1: parsed user script and 95 library script(s) using 86584virt/30540res/5116shr/26196data kb, in 70usr/70sys/156real ms.
Pass 2: analyzed script: 4 probe(s), 3 function(s), 3 embed(s), 3 global(s) using 538896virt/80340res/7000shr/73864data kb, in 1260usr/1700sys/4879real ms.
Pass 3: translated to C into "/tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c" using 536376virt/84028res/10820shr/73864data kb, in 0usr/0sys/14real ms.
In file included from /usr/share/systemtap/runtime/linux/runtime.h:192:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:24:
/usr/share/systemtap/runtime/linux/alloc.c: In function '_stp_kmalloc':
/usr/share/systemtap/runtime/linux/alloc.c:19:8: error: '__GFP_WAIT' undeclared (first use in this function)
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/linux/alloc.c:275:32: note: in expansion of macro 'STP_ALLOC_FLAGS'
return _stp_kmalloc_gfp(size, STP_ALLOC_FLAGS);
^
/usr/share/systemtap/runtime/linux/alloc.c:19:8: note: each undeclared identifier is reported only once for each function it appears in
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/linux/alloc.c:275:32: note: in expansion of macro 'STP_ALLOC_FLAGS'
return _stp_kmalloc_gfp(size, STP_ALLOC_FLAGS);
^
/usr/share/systemtap/runtime/linux/alloc.c: In function '_stp_kzalloc':
/usr/share/systemtap/runtime/linux/alloc.c:19:8: error: '__GFP_WAIT' undeclared (first use in this function)
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/linux/alloc.c:331:33: note: in expansion of macro 'STP_ALLOC_FLAGS'
return _stp_kzalloc_gfp(size, STP_ALLOC_FLAGS);
^
/usr/share/systemtap/runtime/linux/alloc.c: In function '_stp_kmalloc_node':
/usr/share/systemtap/runtime/linux/alloc.c:19:8: error: '__GFP_WAIT' undeclared (first use in this function)
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/linux/alloc.c:428:43: note: in expansion of macro 'STP_ALLOC_FLAGS'
return _stp_kmalloc_node_gfp(size, node, STP_ALLOC_FLAGS);
^
/usr/share/systemtap/runtime/linux/alloc.c: In function '_stp_kzalloc_node':
/usr/share/systemtap/runtime/linux/alloc.c:19:8: error: '__GFP_WAIT' undeclared (first use in this function)
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/linux/alloc.c:432:43: note: in expansion of macro 'STP_ALLOC_FLAGS'
return _stp_kzalloc_node_gfp(size, node, STP_ALLOC_FLAGS);
^
In file included from /usr/share/systemtap/runtime/linux/task_finder2.c:4:0,
from /usr/share/systemtap/runtime/linux/task_finder.c:17,
from /usr/share/systemtap/runtime/linux/runtime.h:202,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:24:
/usr/share/systemtap/runtime/stp_utrace.c: In function 'utrace_task_alloc':
/usr/share/systemtap/runtime/stp_utrace.c:409:59: error: 'GFP_IOFS' undeclared (first use in this function)
struct utrace _utrace = kmem_cache_zalloc(utrace_cachep, GFP_IOFS);
^
/usr/share/systemtap/runtime/stp_utrace.c: In function 'utrace_attach_task':
/usr/share/systemtap/runtime/stp_utrace.c:668:50: error: 'GFP_IOFS' undeclared (first use in this function)
engine = kmem_cache_alloc(utrace_engine_cachep, GFP_IOFS);
^
In file included from /usr/share/systemtap/runtime/linux/runtime.h:192:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:24:
/usr/share/systemtap/runtime/task_finder_vma.c: In function '__stp_tf_vma_new_entry':
/usr/share/systemtap/runtime/linux/alloc.c:19:8: error: '__GFP_WAIT' undeclared (first use in this function)
& ~__GFP_WAIT)
^
/usr/share/systemtap/runtime/task_finder_vma.c:58:64: note: in expansion of macro 'STP_ALLOC_FLAGS'
STP_ALLOC_FLAGS);
^
In file included from /usr/share/systemtap/runtime/print.c:17:0,
from /usr/share/systemtap/runtime/runtime_context.h:22,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:174:
/usr/share/systemtap/runtime/linux/print.c: In function '_stp_print_kernel_info':
/usr/share/systemtap/runtime/linux/print.c:242:20: error: 'struct module' has no member named 'module_core'
THIS_MODULE->module_core,
^
/usr/share/systemtap/runtime/linux/print.c:243:37: error: 'struct module' has no member named 'core_size'
(unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size)/1024,
^
/usr/share/systemtap/runtime/linux/print.c:243:62: error: 'struct module' has no member named 'core_text_size'
(unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size)/1024,
^
/usr/share/systemtap/runtime/linux/print.c:244:44: error: 'struct module' has no member named 'core_text_size'
(unsigned long) (THIS_MODULE->core_text_size)/1024,
^
In file included from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:311:0:
/usr/share/systemtap/runtime/time.c: In function '__stp_time_cpufreq_callback':
/usr/share/systemtap/runtime/time.c:178:14: error: 'CPUFREQ_RESUMECHANGE' undeclared (first use in this function)
case CPUFREQ_RESUMECHANGE:
^
In file included from /usr/share/systemtap/runtime/timer.c:17:0,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:1292:
/usr/share/systemtap/runtime/linux/timer.c: In function '_stp_hrtimer_init':
/usr/share/systemtap/runtime/linux/timer.c:49:2: error: implicit declaration of function 'hrtimer_get_res' [-Werror=implicit-function-declaration]
hrtimer_get_res (CLOCK_MONOTONIC, &res);
^
In file included from /usr/share/systemtap/runtime/linux/runtime.h:192:0,
from /usr/share/systemtap/runtime/runtime.h:24,
from /tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.c:24:
/usr/share/systemtap/runtime/linux/alloc.c: In function 'stp_kmalloc':
/usr/share/systemtap/runtime/linux/alloc.c:276:1: error: control reaches end of non-void function [-Werror=return-type]
}
^
cc1: all warnings being treated as errors
make[1]: *
* [/tmp/stap8EwY4x/stap_e9940a8a3353a2d196e72ff059fa60c3_3482_src.o] Error 1
make: *** [module/tmp/stap8EwY4x] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_e9940a8a3353a2d196e72ff059fa60c3_3482.ko" in 5010usr/4410sys/11814real ms.
Pass 4: compilation failed. [man error::pass4]
Tip: /usr/share/doc/systemtap/README.Debian should help you get started.

@majek
Copy link
Owner

majek commented Oct 4, 2016

yes. systemtap 3.0 is broken with 4.4 kernels. try this:

$ cat /usr/local/systemtap/share/systemtap/runtime/linux/runtime_defines.h
#ifndef __GFP_WAIT
#define __GFP_WAIT __GFP_RECLAIM
#endif

#ifndef GFP_IOFS
#define GFP_IOFS STP_ALLOC_FLAGS
#endif

@mpurzynski
Copy link
Author

Googled around and systemtap is indeed broken on Ubuntu 14.04, they shipped an ancient version. I've built my own - 3.0 and the histogram script compiled without any errors, but it's not collecting any data (intervals is empty). I just cannot believe that net_rx_action() hasn't been called even once ;)

/opt/systemtap/bin/stap -v histogram-kernel.stp 'kernel.function("netif_receive_skb_internal")' 60
Pass 1: parsed user script and 113 library scripts using 101168virt/40548res/5432shr/35640data kb, in 380usr/100sys/747real ms.
Pass 2: analyzed script: 4 probes, 3 functions, 4 embeds, 3 globals using 146280virt/87368res/7076shr/80752data kb, in 1400usr/460sys/2853real ms.
Pass 3: translated to C into "/tmp/stapdIhGQC/stap_38e543485e1e58b9840407bf5f826b81_4565_src.c" using 146280virt/87560res/7268shr/80752data kb, in 0usr/10sys/21real ms.
Pass 4: compiled C into "stap_38e543485e1e58b9840407bf5f826b81_4565.ko" in 3700usr/700sys/7927real ms.
Pass 5: starting run.
ERROR: empty aggregate near operator '@min' at histogram-kernel.stp:39:16
WARNING: Number of errors: 1, skipped probes: 0
WARNING: /opt/systemtap/bin/staprun exited with status: 1
Pass 5: run completed in 20usr/50sys/60550real ms.
Pass 5: run failed. [man error::pass5]

@respection
Copy link

Hi
I have an issue of running your script with the error -
parse error: expected ')'
saw: operator '.' at histogram-kernel.stp:28:9
source: probe $1.call {
^

parse error: expected ')'
saw: operator '.' at histogram-kernel.stp:35:9
source: probe $1.return {

I compiled stap version 3 and the OS is Ubuntu 14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants