systemtap module compilation fails due to `__GFP_REPEAT` undeclared

Bug #1763525 reported by Shivaram Lingamneni on 2018-04-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemtap (Ubuntu)
Medium
TJ

Bug Description

I'm using Ubuntu 17.10, running kernel 4.13.0-38-generic and using systemtap version 3.1-3. I'm trying to run the following systemtap script from here: https://sourceware.org/systemtap/examples/memory/vm.tracepoints.stp

````
#! /usr/bin/env stap

global slabs

probe vm.kmem_cache_alloc {
        slabs [execname(), bytes_req]<<<1
}

probe timer.ms(10000)
{
        dummy = "";
        foreach ([name, bytes] in slabs) {
                if (dummy != name)
                        printf("\nProcess:%s\n", name);
                printf("Slab_size:%d\tCount:%d\n", bytes, @count(slabs[name, bytes]));
                dummy = name;
        }
        delete slabs
        printf("\n-------------------------------------------------------\n\n")
}
````

however, compilation fails due to `__GFP_REPEAT` being undefined:

````
# stap -v ./vm.tracepoints.stp
Pass 1: parsed user script and 465 library scripts using 119732virt/48980res/6868shr/42544data kb, in 100usr/0sys/105real ms.
Pass 2: analyzed script: 2 probes, 2 functions, 5 embeds, 1 global using 123960virt/55004res/8300shr/46772data kb, in 120usr/230sys/345real ms.
Pass 3: translated to C into "/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c" using 123960virt/55004res/8300shr/46772data kb, in 0usr/0sys/0real ms.
/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c: In function ‘function___private__usr_share_systemtap_tapset_linux_memory_stp___gfp_flag_str__overload_0’:
/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c:698:17: error: ‘__GFP_REPEAT’ undeclared (first use in this function); did you mean ‘__GFP_RECLAIM’?
  __GFP_BITMASKS(__GFP_REPEAT)
                 ^
/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c:659:45: note: in definition of macro ‘__GFP_BITMASKS’
 #define __GFP_BITMASKS(FLAG) if(gfp_flag & FLAG) { if(STAP_RETVALUE[0] != '\0') \
                                             ^~~~
/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c:698:17: note: each undeclared identifier is reported only once for each function it appears in
  __GFP_BITMASKS(__GFP_REPEAT)
                 ^
/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.c:659:45: note: in definition of macro ‘__GFP_BITMASKS’
 #define __GFP_BITMASKS(FLAG) if(gfp_flag & FLAG) { if(STAP_RETVALUE[0] != '\0') \
                                             ^~~~
scripts/Makefile.build:308: recipe for target '/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.o' failed
make[1]: *** [/tmp/stapjX0WQQ/stap_2b5505ba8af651817c2f6c55398c5877_6060_src.o] Error 1
Makefile:1550: recipe for target '_module_/tmp/stapjX0WQQ' failed
make: *** [_module_/tmp/stapjX0WQQ] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compiled C into "stap_2b5505ba8af651817c2f6c55398c5877_6060.ko" in 7010usr/880sys/7511real ms.
Pass 4: compilation failed. [man error::pass4]
Tip: /usr/share/doc/systemtap/README.Debian should help you get started.
````

TJ (tj) on 2018-04-12
Changed in systemtap (Ubuntu):
status: New → In Progress
assignee: nobody → TJ (tj)
importance: Undecided → Medium
Frank Ch. Eigler (fche) wrote :

stap 3.2 includes this fix:

commit 73e0af29bb4c1edc1d6e22405ce404dd10569afd
Author: David Smith <email address hidden>
Date: Tue Jul 25 16:09:42 2017 -0500

    Updated tapset/linux/memory.stp for rawhide kernels.

    * tapset/linux/memory.stp (__gfp_flag_str): Updated for rawhide kernels
      with the current list of flags.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers