> With CONFIG_DEBUG_INFO_BTF=m, bpf_get_btf_vmlinux() and > bpf_find_btf_id() do not load the vmlinux BTF: loading waits for user > space, and their callers were not written for that. Besides the bpf() > system call and /sys/kernel/btf/vmlinux, some tracefs and bpffs requests > need the BTF. Load it at the start of those, with > bpf_load_btf_vmlinux(), and have the code that only uses the BTF if it > happens to be there peek: > > - Reading a tracepoint's btf_ids file (events/*/btf_ids): built-in > events use the vmlinux BTF, and module BTF is only registered once > that is loaded. event_btf_ids_read() looks the BTF up under > event_mutex, which the trace notifier of the btf_vmlinux module > takes, so load it before taking the mutex, on the first read() of > the file (not again for the one that returns EOF). > - Probe events with BTF arguments ($argN, argument names, $retval, > [ ... ] > > With CONFIG_DEBUG_INFO_BTF=y bpf_load_btf_vmlinux() is > bpf_get_btf_vmlinux() and the BTF is parsed at boot, so nothing changes. > > Signed-off-by: Jay Wang <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great! -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
