Re: [PATCH] perf/amd: Prevent grouping of IBS events

From: Ian Rogers
Date: Thu Jun 22 2023 - 01:09:36 EST


On Tue, Jun 20, 2023 at 8:27 PM Ravi Bangoria <ravi.bangoria@xxxxxxx> wrote:
>
> Hi Ian,
>
> On 20-Jun-23 10:14 PM, Ian Rogers wrote:
> > On Tue, Jun 20, 2023 at 2:16 AM Ravi Bangoria <ravi.bangoria@xxxxxxx> wrote:
> >>
> >> IBS PMUs can have only one event active at any point in time. Restrict
> >> grouping of multiple IBS events.
> >
> > Thanks Ravi,
> >
> > can you provide an example/test for this? Should this be a weak group issue?
>
> Before:
> $ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
> ^C[ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 0.540 MB perf.data (531 samples) ]
>
> After:
> $ sudo ./perf record -e "{ibs_op//,ibs_op//}" -C 0
> Error:
> AMD IBS may only be available in system-wide/per-cpu mode.
> Try using -a, or -C and workload affinity
>
> The error message is stale and misleading. I have a patch to fix it.
> I'll post it separately.

Thanks Ravi, so this is a workaround for a PMU driver bug where the
perf_event_open should have failed for the sibling event?

The behavior is somewhat reminiscent of arch_evsel__must_be_in_group:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/arch/x86/util/evsel.c?h=perf-tools-next#n41

Normally software events would be valid in the group, should the code
ignore these?

Thanks,
Ian

> Thanks,
> Ravi