Re: [PATCH V5 2/8] perf/x86: Add PERF_X86_EVENT_NEEDS_BRANCH_STACK flag

From: Arnaldo Carvalho de Melo
Date: Tue Nov 07 2023 - 10:21:32 EST


Em Mon, Nov 06, 2023 at 04:19:13PM -0500, Liang, Kan escreveu:
>
>
> On 2023-11-06 4:12 p.m., Arnaldo Carvalho de Melo wrote:
> > Em Wed, Oct 25, 2023 at 01:16:20PM -0700, kan.liang@xxxxxxxxxxxxxxx escreveu:
> >> From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> >>
> >> Currently, branch_sample_type !=0 is used to check whether a branch
> >> stack setup is required. But it doesn't check the sample type,
> >> unnecessary branch stack setup may be done for a counting event. E.g.,
> >> perf record -e "{branch-instructions,branch-misses}:S" -j any
> >> Also, the event only with the new PERF_SAMPLE_BRANCH_COUNTERS branch
> >> sample type may not require a branch stack setup either.
> >>
> >> Add a new flag NEEDS_BRANCH_STACK to indicate whether the event requires
> >> a branch stack setup. Replace the needs_branch_stack() by checking the
> >> new flag.
> >>
> >> The counting event check is implemented here. The later patch will take
> >> the new PERF_SAMPLE_BRANCH_COUNTERS into account.
> >>
> >> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> >> ---
> >>
> >> No changes since V4
> >
> > So I saw this on tip/perf/urgent, I'm picking the tools bits then.
>
> Thanks Arnaldo.
>
> Ian has already reviewed the tool parts.
>
> But I still owe a test case for the feature. I will post a patch later.
> https://lore.kernel.org/lkml/acbb895a-475e-4679-98fc-6b90c05a00af@xxxxxxxxxxxxxxx/

I saw Ian's suggestion, and agree with it, we need to pair new features
with regression tests in 'perf test', thanks for working on it!

- Arnaldo