From: "Chen, Zide" <zide.chen@intel.com>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/6] perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box()
Date: Wed, 13 May 2026 10:58:28 -0700 [thread overview]
Message-ID: <80135abe-c525-4a3d-a75c-438f70b6076b@intel.com> (raw)
In-Reply-To: <20260513023345.ED78AC2BCB0@smtp.kernel.org>
On 5/12/2026 7:33 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The deferred global PMON enablement permanently leaks the hardware power state after the first use, nullifying the intended power savings.
> --
>
> commit ce0046bfd8b6ed5388332db6e76ea45581716939
> Author: Zide Chen <zide.chen@intel.com>
>
> perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box()
>
> This commit drops adl_uncore_msr_init_box() and defers programming the
> ADL_UNC_PERF_GLOBAL_CTL MSR to enable_box(). The goal is to save power by
> ensuring the global control register is only enabled when a box is actually
> used.
>
>> diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
>> index 3dbc6bacbd9de..edddd4f9ab5fc 100644
>> --- a/arch/x86/events/intel/uncore_snb.c
>> +++ b/arch/x86/events/intel/uncore_snb.c
> [ ... ]
>> -static void adl_uncore_msr_init_box(struct intel_uncore_box *box)
>> -{
>> - if (box->pmu->pmu_idx == 0)
>> - wrmsrq(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN);
>> -}
>> -
>> static void adl_uncore_msr_enable_box(struct intel_uncore_box *box)
>> {
>> wrmsrq(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN);
>
> Does this unintentionally leave the hardware power state permanently enabled
> after the first use?
>
> The Linux perf core framework unconditionally calls perf_pmu_enable(), which
> maps to uncore_pmu_enable() and executes enable_box(), at the end of PMU
> transactions. This includes event removal sequences:
>
> perf_pmu_disable()
> event->pmu->del()
> perf_pmu_enable()
>
> Since adl_uncore_msr_enable_box() unconditionally writes
> SNB_UNC_GLOBAL_CTL_EN, it seems the global PMON control is immediately
> re-enabled and remains active even when zero events are in use, negating
> the intended power savings.
> Additionally, if a check like if (box->n_active) were added here, could
> that silently break concurrent perf sessions on other uncore boxes?
The additional power consumption occurs as soon as the MSR is written to
any value — not because the global control remains enabled. So checking
n_active or disabling the global control when no events are active
wouldn't help.
> Because disable_box() unconditionally clears the shared MSR during
> transactions if pmu_idx == 0, failing to re-enable it would leave PMON
> globally disabled for the entire die. Safely managing dynamic power for this
> shared global MSR might require a package-level active reference count
> across all boxes.
Again, for the power consumption concern, the only thing we need to do
is to postpone the write to the global control MSR (0x2ff0), and after
the first write, it's irrelevant.
Regarding the concern of the disable_box(), I'd like to address it
separately from this patch. The fix here is simply to defer the first
write until it's actually needed.
>> @@ -587,7 +581,6 @@ static void adl_uncore_msr_exit_box(struct intel_uncore_box *box)
>> }
>>
>> static struct intel_uncore_ops adl_uncore_msr_ops = {
>> - .init_box = adl_uncore_msr_init_box,
>> .enable_box = adl_uncore_msr_enable_box,
>> .disable_box = adl_uncore_msr_disable_box,
>> .exit_box = adl_uncore_msr_exit_box,
>
next prev parent reply other threads:[~2026-05-13 17:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 23:05 [PATCH 0/6] perf/x86/intel/uncore: Bug fixes and cleanups Zide Chen
2026-05-11 23:05 ` [PATCH 1/6] perf/x86/intel/uncore: Fix discovery unit lookup for multi-die systems Zide Chen
2026-05-13 1:49 ` sashiko-bot
2026-05-13 18:35 ` Chen, Zide
2026-05-11 23:05 ` [PATCH 2/6] perf/x86/intel/uncore: Fix PCI device refcount leak in UPI discovery Zide Chen
2026-05-12 9:27 ` Mi, Dapeng
2026-05-12 17:35 ` Chen, Zide
2026-05-13 0:31 ` Mi, Dapeng
2026-05-11 23:05 ` [PATCH 3/6] perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box() Zide Chen
2026-05-13 2:33 ` sashiko-bot
2026-05-13 17:58 ` Chen, Zide [this message]
2026-05-11 23:05 ` [PATCH 4/6] perf/x86/intel/uncore: Move die_to_cpu() to uncore.c Zide Chen
2026-05-13 2:58 ` sashiko-bot
2026-05-13 18:11 ` Chen, Zide
2026-05-11 23:05 ` [PATCH 5/6] perf/x86/intel/uncore: Fix uncore_die_to_cpu() for offline dies Zide Chen
2026-05-11 23:05 ` [PATCH 6/6] perf/x86/intel/uncore: Implement global init callback for GNR uncore Zide Chen
2026-05-13 4:25 ` sashiko-bot
2026-05-13 18:26 ` Chen, Zide
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=80135abe-c525-4a3d-a75c-438f70b6076b@intel.com \
--to=zide.chen@intel.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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