-
Notifications
You must be signed in to change notification settings - Fork 118
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
xcapture-bpf error: no member named '__state' in 'struct task_struct' #51
Comments
This is due to a kernel structure change between somewhere in 4.18 and 5.x, where the kernel scheduler developers renamed the I have to head out (to drink beer with friends) soon, so for now you can just replace all occurrences of |
The PR #53 should fix it. |
Oh, now I remember why I had removed that kernel version check earlier. Redhat backported these
In the Or if thre's some Reopening the issue for now. |
I don't have time to go deeper myself right now, but at least ChatGPT told me that there are RHEL-specific defines: RHEL_MAJOR and RHEL_MINOR: These macros are defined in the file /usr/include/linux/version.h or /usr/include/linux/rh_version.h (depending on the kernel and version). They indicate the major and minor version of the RHEL kernel. Looks like indeed they do exist: |
Oh my, I see, I wasn't aware of the task->__state backport to the RHEL8 4.18 kernels. Unfortunately with #53, xcapture-bpf.c now breaks on RHEL8. So yeah, another (still quick 'n dirty) fix to get this addressed could be something like that:
Just managed to quickly get that tested on RHEL 8.10, 9.5 and OEL 8.10 and will submit a new PR shortly. |
[root@10-35-19-16 0xtools]# uname -a
Linux 10-35-19-16 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@10-35-19-16 0xtools]# cat /etc/redhat-release
CentOS Linux release 8.4.2105
[root@10-35-19-16 0xtools]# ./bin/xtop
=== [0x.tools] xtop 2.0.3 BETA by Tanel Poder. Centos Linux 8 4.18.0 x86_64
=== Loading BPF...
In file included from :2:
In file included from /virtual/include/bcc/bpf.h:12:
In file included from include/linux/types.h:6:
In file included from include/uapi/linux/types.h:14:
In file included from include/uapi/linux/posix_types.h:5:
In file included from include/linux/stddef.h:5:
In file included from include/uapi/linux/stddef.h:2:
In file included from include/linux/compiler_types.h:74:
include/linux/compiler-clang.h:25:9: warning: '__no_sanitize_address' macro redefined [-Wmacro-redefined]
#define __no_sanitize_address
^
include/linux/compiler-gcc.h:213:9: note: previous definition is here
#define __no_sanitize_address attribute((no_sanitize_address))
^
/virtual/main.c:173:29: error: no member named '__state' in 'struct task_struct'; did you mean 'state'?
t->state = curtask->__state;
^~~~~~~
state
include/linux/sched.h:424:18: note: 'state' declared here
volatile long state;
^
/virtual/main.c:312:37: error: no member named '__state' in 'struct task_struct'; did you mean 'state'?
unsigned int prev_state = prev->__state; // ctx->args[3] won't work in older configs due to breaking change in sched_switch tracepoint
^~~~~~~
state
include/linux/sched.h:424:18: note: 'state' declared here
volatile long state;
^
/virtual/main.c:371:31: error: no member named '__state' in 'struct task_struct'; did you mean 'state'?
t_next->state = next->__state;
^~~~~~~
state
include/linux/sched.h:424:18: note: 'state' declared here
volatile long state;
^
1 warning and 3 errors generated.
Traceback (most recent call last):
File "/root/0xtools/bin/xcapture-bpf", line 474, in
b = BPF(text= ifdef + bpf_text)
File "/usr/lib/python3.6/site-packages/bcc/init.py", line 365, in init
raise Exception("Failed to compile BPF module %s" % (src_file or ""))
Exception: Failed to compile BPF module
The text was updated successfully, but these errors were encountered: