tanelpoder / 0xtools

0x.Tools: X-Ray vision for Linux systems
https://0x.tools
GNU General Public License v2.0
1.47k stars 115 forks source link

bpf_attach_raw_tracepoint (sched_switch): Invalid argument on ARM64 #40

Closed skoehler-soocs closed 5 months ago

skoehler-soocs commented 5 months ago

[root@OEL89 bin]# uname -r 5.15.0-202.135.2.el8uek.aarch64

[root@OEL89 bin]# ./xtop Loading BPF... bpf_attach_raw_tracepoint (sched_switch): Invalid argument Traceback (most recent call last): File "/tmp/0xtools/0xtools-master/bin/xcapture-bpf", line 335, in b = BPF(text=bpf_text) File "/usr/lib/python3.6/site-packages/bcc/init.py", line 484, in init self._trace_autoload() File "/usr/lib/python3.6/site-packages/bcc/init.py", line 1468, in _trace_autoload self.attach_raw_tracepoint(tp=tp, fn_name=fn.name) File "/usr/lib/python3.6/site-packages/bcc/init.py", line 1061, in attach_raw_tracepoint raise Exception("Failed to attach BPF to raw tracepoint") Exception: Failed to attach BPF to raw tracepoint

tanelpoder commented 5 months ago

Fixed, there used to be a breaking change in the sched_switch tracepoint argument signature - and not all BPF client & compilation libraries agree apparently. This is possibly because on OEL8 you have UEK kernel but RedHat-supplied libraries (compatible with 4.18) interacting with these kernel functions. But I have previously made sure that all the libbpf, bcc libraries are installed from the UEK repo (by default yum/dnf may pick the wrong ones), but still got that error. I use a better way to get the prev_state now and works on my OEL8 with UEK 5.15 on ARM.

tanelpoder commented 5 months ago

Anyone wondering about the tracepoint prev_state change (and the rabbithole leads deeper to the linux kernel task state vs __state), this:

https://lore.kernel.org/lkml/93a20759600c05b6d9e4359a1517c88e06b44834.camel@fb.com/