Re: [RFC PATCH] perf stat: Separate bperf from bpf_profiler

From: Song Liu
Date: Thu May 04 2023 - 22:01:24 EST


On Fri, Apr 28, 2023 at 6:44 PM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
>
> Em Fri, Apr 21, 2023 at 10:56:10PM +0200, Dmitry Dolgov escreveu:
> > > On Wed, Apr 12, 2023 at 08:23:16PM +0200, Dmitrii Dolgov wrote:
> > > It seems that perf stat -b <prog id> doesn't produce any results:
> > >
> > > $ perf stat -e cycles -b 4 -I 10000 -vvv
> > > Control descriptor is not initialized
> > > cycles: 0 0 0
> > > time counts unit events
> > > 10.007641640 <not supported> cycles
> > >
> > > Looks like this happens because fentry/fexit progs are getting loaded, but the
> > > corresponding perf event is not enabled and not added into the events bpf map.
> > > I think there is some mixing up between two type of bpf support, one for bperf
> > > and one for bpf_profiler. Both are identified via evsel__is_bpf, based on which
> > > perf events are enabled, but for the latter (bpf_profiler) a perf event is
> > > required. Using evsel__is_bperf to check only bperf produces expected results:
> >
> > Any thoughts on this? I would appreciate clarifications if I'm missing
> > something.
>
> Namhyung, Song, can you please take a look at this?

Sorry for the late response. The fix looks good to me and worked well
in my test.

Reviewed-and-tested-by: Song Liu <song@xxxxxxxxxx>

I guess we also need:

Fixes: 112cb56164bc2 ("perf stat: Introduce config stat.bpf-counter-events")

Thanks for the fix!
Song