Kernels without BTF
ntprof reads kernel structures through CO-RE (compile once, run everywhere): libbpf matches each field it reads against the running kernel's BTF type information when it loads. fentry/fexit hooks also need it.
Kernels built without BTF
If the kernel has no /sys/kernel/btf/vmlinux but its modules carry debug info (CONFIG_DEBUG_INFO=y), generate
BTF from the modules and pass it; ntprof then uses kprobes.
tools/gen-btf.sh /tmp/ntprof-btf # nvme_tcp.btf, nvmet_tcp.btf, nvme_rdma.btf, nvmet_rdma.btf
sudo ntprof record --btf /tmp/ntprof-btf
Modules built out of tree (MLNX OFED)
A kernel with BTF can still load NVMe modules without it: MLNX OFED's DKMS packages install stripped modules, so
/sys/kernel/btf/nvmet_tcp and the others are missing. ntprof probe then shows module BTF …: absent; kprobes,
and recording without --btf stops with a message that says what to do. Rebuild the same source with debug info in
a directory of your own (nothing is installed or loaded) and generate the BTF from that build:
cp -r /usr/src/mlnx-nvme-<version> ~/mlnx-nvme-dbg && cd ~/mlnx-nvme-dbg
make KVER=$(uname -r) K_BUILD=/lib/modules/$(uname -r)/build CONFIG_NVME_HOST_WITHOUT_FC=
modinfo -F srcversion host/nvme-tcp.ko; modinfo -F srcversion nvme_tcp # the same source
mkdir ~/kos && cp host/nvme-tcp.ko host/nvme-rdma.ko target/nvmet-tcp.ko target/nvmet-rdma.ko ~/kos
tools/gen-btf.sh ~/ntprof-btf ~/kos
sudo ntprof record -r target --btf ~/ntprof-btf
The make line is the one in the package's dkms.conf. Build with the compiler the kernel was built with
(cat /proc/version) if it is installed. Objects whose module has BTF keep fentry; the others use kprobes.