Right, fixed in v4 (patch 5/12, with the other tracefs and bpffs requests that load the BTF): https://lore.kernel.org/bpf/[email protected]/
event_btf_ids_read() now calls bpf_load_btf_vmlinux() before it takes event_mutex, so the btf_vmlinux module load and its trace notifier run without it; btf_get_module_btf(NULL) under the mutex then finds the BTF already parsed. More generally, in v4 the lookups themselves never load the BTF any more (see the reply to Alexei on 4/9): the probe argument parser (PROBE_EVENTS_BTF_ARGS) loads it explicitly, holding only dyn_event_ops_mutex, which loading a module never takes. Tested by reading events/sched/sched_switch/btf_ids, and by creating kprobe events with BTF arguments, each as the first BTF user after boot. Jay
