From: Peter Zijlstra <peterz@infradead.org>
To: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Andi Kleen <ak@linux.intel.com>,
Eranian Stephane <eranian@google.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Dapeng Mi <dapeng1.mi@intel.com>, Zide Chen <zide.chen@intel.com>,
Falcon Thomas <thomas.falcon@intel.com>,
Xudong Hao <xudong.hao@intel.com>,
stable@vger.kernel.org
Subject: Re: [RESEND Patch 2/2] perf/x86/intel: Add missing branch counters constraint apply
Date: Wed, 11 Mar 2026 21:16:25 +0100 [thread overview]
Message-ID: <20260311201625.GW606826@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260228053320.140406-2-dapeng1.mi@linux.intel.com>
On Sat, Feb 28, 2026 at 01:33:20PM +0800, Dapeng Mi wrote:
> diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> index 4768236c054b..4b042d71104f 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -4628,6 +4628,19 @@ static inline void intel_pmu_set_acr_caused_constr(struct perf_event *event,
> event->hw.dyn_constraint &= hybrid(event->pmu, acr_cause_mask64);
> }
>
> +static inline int intel_set_branch_counter_constr(struct perf_event *event,
> + int *num)
> +{
> + if (branch_sample_call_stack(event))
> + return -EINVAL;
> + if (branch_sample_counters(event)) {
> + (*num)++;
> + event->hw.dyn_constraint &= x86_pmu.lbr_counters;
> + }
> +
> + return 0;
> +}
> +
> static int intel_pmu_hw_config(struct perf_event *event)
> {
> int ret = x86_pmu_hw_config(event);
> @@ -4698,21 +4711,18 @@ static int intel_pmu_hw_config(struct perf_event *event)
> * group, which requires the extra space to store the counters.
> */
> leader = event->group_leader;
> + if (intel_set_branch_counter_constr(leader, &num))
> return -EINVAL;
> leader->hw.flags |= PERF_X86_EVENT_BRANCH_COUNTERS;
>
> for_each_sibling_event(sibling, leader) {
> + if (intel_set_branch_counter_constr(sibling, &num))
> + return -EINVAL;
> + }
> +
Do the new bit is this, right?
> + if (event != leader) {
> + if (intel_set_branch_counter_constr(event, &num))
> return -EINVAL;
> }
The point being that for_each_sibling_event() will not have iterated the
event because its not on the list yet?
That wasn't really clear from the changelog and I think that deserves a
comment as well.
Let me go fix that.
next prev parent reply other threads:[~2026-03-11 20:18 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-28 5:33 [RESEND Patch 1/2] perf/x86/intel: Only check GP counters for PEBS constraints validation Dapeng Mi
2026-02-28 5:33 ` [RESEND Patch 2/2] perf/x86/intel: Add missing branch counters constraint apply Dapeng Mi
2026-03-07 1:27 ` Chen, Zide
2026-03-11 20:03 ` Peter Zijlstra
2026-03-12 2:02 ` Mi, Dapeng
2026-03-11 20:16 ` Peter Zijlstra [this message]
2026-03-12 2:31 ` Mi, Dapeng
2026-03-12 6:41 ` Peter Zijlstra
2026-03-12 6:52 ` Mi, Dapeng
2026-03-12 7:40 ` Peter Zijlstra
2026-03-16 9:50 ` [tip: perf/urgent] " tip-bot2 for Dapeng Mi
2026-03-07 1:27 ` [RESEND Patch 1/2] perf/x86/intel: Only check GP counters for PEBS constraints validation Chen, Zide
2026-03-12 8:28 ` Mi, Dapeng
2026-03-12 8:42 ` Peter Zijlstra
2026-03-12 8:44 ` Mi, Dapeng
2026-03-16 9:50 ` [tip: perf/core] " tip-bot2 for Dapeng Mi
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=20260311201625.GW606826@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=dapeng1.mi@intel.com \
--cc=dapeng1.mi@linux.intel.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=stable@vger.kernel.org \
--cc=thomas.falcon@intel.com \
--cc=xudong.hao@intel.com \
--cc=zide.chen@intel.com \
/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