iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.57k stars 3.88k forks source link

Exception:Failed to attach BPF program b'trace_req_done' to kprobe b'blk_account_io_done', it's not traceable (either non-existing, inlined, or marked as "notrace") #5124

Open zydmtaichi opened 3 weeks ago

zydmtaichi commented 3 weeks ago

kernel version: 6.8.0-40-generic system version: ubuntu 22.04 debug info:

cannot attach kprobe, Invalid argument
Traceback (most recent call last):
  File "/mnt/sdb/bcc/examples/tracing/bitehist.py", line 39, in <module>
    b.attach_kprobe(event="blk_account_io_done", fn_name="trace_req_done")
  File "/usr/lib/python3/dist-packages/bcc-0.31.0+0d5dcf40-py3.10.egg/bcc/__init__.py", line 881, in attach_kprobe
Exception: Failed to attach BPF program b'trace_req_done' to kprobe b'blk_account_io_done', it's not traceable (either non-existing, inlined, or marked as "notrace")

the kernel config is checked as below:

CONFIG_KPROBES=y
CONFIG_KPROBES_ON_FTRACE=y
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KPROBES_ON_FTRACE=y
CONFIG_KPROBE_EVENTS=y
# CONFIG_KPROBE_EVENTS_ON_NOTRACE is not set
CONFIG_BPF_KPROBE_OVERRIDE=y
# CONFIG_KPROBE_EVENT_GEN_TEST is not set
# CONFIG_SAMPLE_KPROBES is not set

and the command grep blk_account_io_done /proc/kallsyms output as below:

ffffffff9a1c1890 t __pfx_blk_account_io_done
ffffffff9a1c18a0 t blk_account_io_done
zydmtaichi commented 3 weeks ago

@chenhengqi