[缺陷描述]: bpftrace-test测试,biosnoop用例失败,ERROR: Struct/union of type 'struct request' does not contain a field named 'rq_disk' 测试日志如下: /usr/share/bpftrace/tools/biosnoop.bt failed ERROR: BTF: failed to read data (Invalid argument) from: /sys/kernel/btf/vmlinux ERROR: BTF: failed to read data (Invalid argument) from: /usr/lib/debug/lib/modules/6.6.71-3_rc1.al8.aarch64/vmlinux ERROR: BTF: failed to find BTF data ERROR: BTF: failed to read data (Invalid argument) from: /sys/kernel/btf/vmlinux ERROR: BTF: failed to read data (Invalid argument) from: /usr/lib/debug/lib/modules/6.6.71-3_rc1.al8.aarch64/vmlinux ERROR: BTF: failed to find BTF data AST after: parser ------------------- #ifndef BPFTRACE_HAVE_BTF #include <linux/blkdev.h> #include <linux/blk-mq.h> #endif Program BEGIN call: printf :: type[none, ctx: 0] string: %-12s %-7s %-16s %-6s %7s\n :: type[none, ctx: 0] string: TIME(ms) :: type[none, ctx: 0] string: DISK :: type[none, ctx: 0] string: COMM :: type[none, ctx: 0] string: PID :: type[none, ctx: 0] string: LAT(ms) :: type[none, ctx: 0] kprobe:blk_account_io_start = map: @start :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] builtin: nsecs :: type[none, ctx: 0] = map: @iopid :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] builtin: pid :: type[none, ctx: 0] = map: @iocomm :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] builtin: comm :: type[none, ctx: 0] = map: @disk :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] . dereference . dereference (struct request*) builtin: arg0 :: type[none, ctx: 0] rq_disk disk_name kprobe:blk_account_io_done pred && :: type[none, ctx: 0] && :: type[none, ctx: 0] != :: type[none, ctx: 0] map: @start :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] int: 0 :: type[none, ctx: 0] != :: type[none, ctx: 0] map: @iopid :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] int: 0 :: type[none, ctx: 0] != :: type[none, ctx: 0] map: @iocomm :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] string: :: type[none, ctx: 0] = variable: $now :: type[none, ctx: 0] builtin: nsecs :: type[none, ctx: 0] call: printf :: type[none, ctx: 0] string: %-12u %-7s %-16s %-6d %7d\n :: type[none, ctx: 0] / :: type[none, ctx: 0] builtin: elapsed :: type[none, ctx: 0] int: 1000000 :: type[none, ctx: 0] map: @disk :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] map: @iocomm :: type[none, ctx: 0] /usr/share/bpftrace/tools/biosnoop.bt:30:16-50: ERROR: Struct/union of type 'struct request' does not contain a field named 'rq_disk' builtin: arg0 :: type[none, ctx: 0] map: @iopid :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] / :: type[none, ctx: 0] - :: type[none, ctx: 0] variable: $now :: type[none, ctx: 0] map: @start :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] int: 1000000 :: type[none, ctx: 0] call: delete :: type[none, ctx: 0] map: @start :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] call: delete :: type[none, ctx: 0] map: @iopid :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] call: delete :: type[none, ctx: 0] map: @iocomm :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] call: delete :: type[none, ctx: 0] map: @disk :: type[none, ctx: 0] builtin: arg0 :: type[none, ctx: 0] END call: clear :: type[none, ctx: 0] map: @start :: type[none, ctx: 0] call: clear :: type[none, ctx: 0] map: @iopid :: type[none, ctx: 0] call: clear :: type[none, ctx: 0] map: @iocomm :: type[none, ctx: 0] call: clear :: type[none, ctx: 0] map: @disk :: type[none, ctx: 0] [重现概率]: 必现 [重现环境]: 环境信息:倚天710机器 100.82.243.208 #uname -r 6.6.71-3_rc1.al8.aarch64 #cat /etc/os-release NAME="Alibaba Cloud Linux" VERSION="3 (Soaring Falcon)" ID="alinux" ID_LIKE="rhel fedora centos anolis" VERSION_ID="3" UPDATE_ID="10" PLATFORM_ID="platform:al8" PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)" ANSI_COLOR="0;31" HOME_URL="https://www.aliyun.com/" #lscpu Architecture: aarch64 Byte Order: Little Endian CPU(s): 124 On-line CPU(s) list: 0-123 Thread(s) per core: 1 Core(s) per socket: 124 Socket(s): 1 NUMA node(s): 2 Vendor ID: ARM BIOS Vendor ID: T-HEAD Model: 0 Model name: Neoverse-N2 BIOS Model name: Yitian710-124 Stepping: r0p0 CPU MHz: 2750.002 BogoMIPS: 100.00 Hypervisor vendor: Alibaba Virtualization type: full L1d cache: 64K L1i cache: 64K L2 cache: 1024K L3 cache: 65536K NUMA node0 CPU(s): 0-61 NUMA node1 CPU(s): 62-123 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm sb dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svebf16 i8mm bf16 dgh #free -h total used free shared buff/cache available Mem: 251Gi 5.7Gi 243Gi 9.0Mi 4.0Gi 245Gi Swap: 2.0Gi 116Mi 1.9Gi #cat /proc/cmdline BOOT_IMAGE=(hd0,gpt2)/boot/vmlinuz-6.6.71-3_rc1.al8.aarch64 root=UUID=5d4c9cac-5324-464b-8971-09deff261ae7 ro biosdevname=0 rd.driver.pre=ahci iommu.passthrough=1 iommu.strict=0 nospectre_bhb ssbd=force-off systemd.unified_cgroup_hierarchy=0 cgroup.memory=nokmem console=ttyS0,115200 fsck.repair=yes crashkernel=0M-2G:0M,2G-256G:256M,256G-1024G:320M,1024G-:384M #rpm -qa | grep kernel | grep 6.6.71-3_rc1.al8 kernel-devel-6.6.71-3_rc1.al8.aarch64 kernel-headers-6.6.71-3_rc1.al8.aarch64 kernel-debuginfo-6.6.71-3_rc1.al8.aarch64 kernel-6.6.71-3_rc1.al8.aarch64 kernel-debuginfo-common-aarch64-6.6.71-3_rc1.al8.aarch64 #yum install bpftrace Last metadata expiration check: 21:28:05 ago on Mon 03 Mar 2025 01:01:45 PM CST. Package bpftrace-0.16.0-8.al8.aarch64 is already installed. Dependencies resolved. Nothing to do. Complete! #yum install bpftrace-test Last metadata expiration check: 21:28:09 ago on Mon 03 Mar 2025 01:01:45 PM CST. Package bpftrace-test-0.16.0-8.al8.aarch64 is already installed. Dependencies resolved. Nothing to do. Complete! [重现步骤]: 1. 安装6.6.71-3_rc1.al8.aarch64内核,并重启生效 2. yum install bpftrace 3. /usr/share/bpftrace/tools/biosnoop.bt [期望结果]: 用例执行PASS [实际结果]: 用例执行Fail [分析] 看起来是缺少 BTF data 以及有1个报错Struct/union of type 'struct request' does not contain a field named 'rq_disk'
已知问题,目前该版本bpftrace这两个用例不适配6.6内核。对于6.6内核,用上游最新的biosnoop用例也存在问题,这是因为biosnoop用例中用到的blk_account_io_start等变成了内联函数导致其不可traceable attach kprobe,目前上游bpftrace还没有就该问题对内核做进一步的适配