Re: [PATCH v5 5/5] perf-stat: introduce bpf_counter_ops->disable()
From: Jiri Olsa
Date: Mon May 03 2021 - 10:10:06 EST
On Thu, Apr 29, 2021 at 10:40:01PM +0000, Song Liu wrote:
SNIP
> >>>>> #include "../perf.h"
> >>>>> @@ -421,6 +422,9 @@ static void __evlist__disable(struct evlist *evlist, char *evsel_name)
> >>>>> if (affinity__setup(&affinity) < 0)
> >>>>> return;
> >>>>>
> >>>>> + evlist__for_each_entry(evlist, pos)
> >>>>> + bpf_counter__disable(pos);
> >>>>
> >>>> I was wondering why you don't check evsel__is_bpf like
> >>>> for the enable case.. and realized that we don't skip
> >>>> bpf evsels in __evlist__enable and __evlist__disable
> >>>> like we do in read_affinity_counters
> >>>>
> >>>> so I guess there's extra affinity setup and bunch of
> >>>> wrong ioctls being called?
> >>>
> >>> We actually didn't do wrong ioctls because the following check:
> >>>
> >>> if (... || !pos->core.fd)
> >>> continue;
> >>>
> >>> in __evlist__enable and __evlist__disable. That we don't allocate
> >>> core.fd for is_bpf events.
> >>>
> >>> It is probably good to be more safe with an extra check of
> >>> evsel__is_bpf(). But it is not required with current code.
> >>
> >> hum, but it will do all the affinity setup no? for no reason,
> >> if there's no non-bpb event
> >
> > Yes, it will do the affinity setup. Let me see how to get something
> > like all_counters_use_bpf here (or within builtin-stat.c).
> >
>
> Would something like the following work? It is not clean (skipping some
> useful logic in __evlist__[enable|disable]). But it seems to work in the
> tests.
sorry for late reply, but I can't no longer apply this:
patching file tools/perf/builtin-stat.c
Hunk #1 FAILED at 572.
Hunk #2 FAILED at 581.
2 out of 2 hunks FAILED -- saving rejects to file tools/perf/builtin-stat.c.rej
patching file tools/perf/util/evlist.c
Hunk #1 FAILED at 425.
1 out of 1 hunk FAILED -- saving rejects to file tools/perf/util/evlist.c.rej
ah, I see the patchset got already merged.. not sure why I'm doing review then ;-)
thanks,
jirka