Re: [PATCH 2/3] perf: collect BPF metadata from existing BPF programs
From: Blake Jones
Date: Tue Jun 03 2025 - 17:55:16 EST
Hi Namhyung,
On Tue, Jun 3, 2025 at 2:44 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > > IIUC the metadata is collected for each BPF program which may have
> > > multiple subprograms. Then this patch creates multiple PERF_RECORD_
> > > BPF_METADATA for each subprogram, right?
> > >
> > > Can it be shared using the BPF program ID?
> >
> > In theory, yes, it could be shared. But I want to be able to correlate them
> > with the corresponding PERF_RECORD_KSYMBOL events, and KSYMBOL events for
> > subprograms don't have the full-program ID, so I wouldn't be able to do that.
>
> It's unfortunate that KSYMBOL doesn't have the program ID, but IIRC the
> following BPF_EVENT should have it. I think it's safe to think KSYMBOLs
> belong to the BPF_EVENT when they are from the same thread.
Hmmm. Is that documented and tested anywhere? Offhand it sounds like an
implementation detail that I wouldn't feel great about depending on -
certainly not without a strong guarantee that it wouldn't change.
Can you say more about why the duplicated records concern you?
Blake