From: Sandipan Das <sandipan.das@amd.com>
To: Ian Rogers <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Thomas Gleixner <tglx@kernel.org>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Ravi Bangoria <ravi.bangoria@amd.com>,
Ananth Narayan <ananth.narayan@amd.com>
Subject: Re: [PATCH] perf/x86/amd/uncore: Add group validation
Date: Wed, 24 Jun 2026 12:09:26 +0530 [thread overview]
Message-ID: <71f4c100-ea02-4a64-b2ee-5bd2d5d01fbb@amd.com> (raw)
In-Reply-To: <CAP-5=fVg-mjLj2v6Q2kXMBU26rn=CgZNyFE7O=-+ZuE90RC_8Q@mail.gmail.com>
On 23-06-2026 22:46, Ian Rogers wrote:
> On Tue, Jun 23, 2026 at 3:49 AM Sandipan Das <sandipan.das@amd.com> wrote:
>>
>> The amd_uncore driver currently does not validate event groups and
>> allows creation of groups with more events than the number of available
>> hardware counters. Because of this, pmu->event_init() succeeds but
>> counter assignment fails later in pmu->add() which returns -EBUSY once
>> all counters are exhausted.
>>
>> Address this by introducing group validation in the pmu->event_init()
>> path. Since the uncore PMUs have no per-event constraints and all
>> counters of a PMU are interchangeable, validation is reduced to just
>> counting the group members that target a PMU and ensuring that they fit
>> within the available set of counters.
>>
>> Signed-off-by: Sandipan Das <sandipan.das@amd.com>
>
> This is great Sandipan! Thanks for addressing this! I'd been wondering
> if in the perf tool if we could test hardware PMUs for not supporting
> failing at open properly. This is a problem for weak groups, as used
> by metrics, because they try to group all events and then break the
> group when the open fails. I'd observed that AMD uncore events
> supposedly opened but then failed during reading. I suspect other PMUs
> also suffer this.
>
> Peter mentioned a behavior in the past: opening events in a group in a
> disabled state, with more events than counters, and then the software
> enables and disables events in the group to control counter
> allocation. The perf tool doesn't currently utilize this behavior but
> I think it explains some of the Sashiko feedback.
>
Thanks, I think it does explain the Sashiko feedback.
> Would it be possible to get a Fixes tag for stable backports?
>
Sure. This has always been a gap in the amd_uncore driver ever since
its introduction in commit c43ca5091a37 ("perf/x86/amd: Add support for
AMD NB and L2I "uncore" counters.").
prev parent reply other threads:[~2026-06-24 6:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 10:49 [PATCH] perf/x86/amd/uncore: Add group validation Sandipan Das
2026-06-23 11:04 ` sashiko-bot
2026-06-23 17:16 ` Ian Rogers
2026-06-24 6:39 ` Sandipan Das [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71f4c100-ea02-4a64-b2ee-5bd2d5d01fbb@amd.com \
--to=sandipan.das@amd.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=ananth.narayan@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@amd.com \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox