Bug 22327 - the loadavg tapset no longer works on recent kernels
Summary: the loadavg tapset no longer works on recent kernels
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-20 13:30 UTC by David Smith
Modified: 2017-10-25 13:18 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Smith 2017-10-20 13:30:45 UTC
The loadavg.stp tapset file causes compile errors when used on newer kernels (4.14.0-0.rc4.git4.1.fc28.x86_64):

===
# stap -e 'probe begin { printf("%d\n", get_loadavg_index(0)) }'
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c: In function ‘function___global_get_loadavg_index__overload_0’:
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c:223:10: error: ‘avenrun’ undeclared (first use in this function)
  value = avenrun[STAP_ARG_indx] + (FIXED_1/200);
          ^~~~~~~
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c:223:10: note: each undeclared identifier is reported only once for each function it appears in
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c:223:36: error: ‘FIXED_1’ undeclared (first use in this function)
  value = avenrun[STAP_ARG_indx] + (FIXED_1/200);
                                    ^~~~~~~
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c:35:29: error: ‘FSHIFT’ undeclared (first use in this function); did you mean ‘FS_XFS’?
 #define LOAD_INT(x) ((x) >> FSHIFT)
                             ^
/tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.c:225:18: note: in expansion of macro ‘LOAD_INT’
  STAP_RETVALUE = LOAD_INT(value);
                  ^~~~~~~~
make[1]: *** [scripts/Makefile.build:313: /tmp/stap1Qjd3Z/stap_6b78fa1883092e0faa7bc608dd2ee82f_1402_src.o] Error 1
make: *** [Makefile:1502: _module_/tmp/stap1Qjd3Z] Error 2
WARNING: kbuild exited with status: 2
Pass 4: compilation failed.  [man error::pass4]
====

This happens because the following kernel commit moved the loadavg related definitions:

====
commit dea38c74cb9205341f52b8d8ae18f61247a43ea8
Author: Ingo Molnar <mingo@kernel.org>
Date:   Wed Feb 1 18:25:37 2017 +0100

    sched/headers: Move loadavg related definitions from <linux/sched.h> to <linux/sched/loadavg.h>
    
    Move these bits to <linux/sched/loadavg.h>, to reduce the size and
    complexity of <linux/sched.h>.
====

The tapset will need to adapt.
Comment 1 David Smith 2017-10-25 13:18:41 UTC
Fixed in commit d31813abd. This commit also adds a buildok test, so we'll notice any breakage more quickly in the future.