On 9/19/18 4:30 PM, Song Liu wrote: > > >> On Sep 19, 2018, at 3:39 PM, Alexei Starovoitov <a...@kernel.org> wrote: >> >> introduce perf_event_mmap_bpf_prog() helper to emit RECORD_MMAP events >> into perf ring buffer. >> It's used by bpf load/unload logic to notify user space of addresses >> and names of JITed bpf programs. >> >> Note that event->mmap.pid == -1 is an existing indicator of kernel event. >> In addition use event->mmap.tid == BPF_FS_MAGIC to indicate bpf related >> RECORD_MMAP event. >> >> Alternatively it's possible to introduce new 'enum perf_event_type' command >> specificially for bpf prog load/unload, but existing RECORD_MMAP >> is very close, so the choice made by this patch is to extend it. >> >> Signed-off-by: Alexei Starovoitov <a...@kernel.org> > > Acked-by: Song Liu <songliubrav...@fb.com> > > I guess we should also use this for kernel modules load/unload?
yes. that's possible. There is similar issue with modules today that get unloaded before 'perf report'. Synthetic record_mmap for modules that perf emits into perf.data has filename==module_name. It solves typical use case though. We can extend record_mmap further and let kernel emit them for module load/unload. Some new magic for 'tid' would be necessary.