From: sashiko-bot@kernel.org
To: "Zide Chen" <zide.chen@intel.com>
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 02:33:45 +0000 [thread overview]
Message-ID: <20260513023345.ED78AC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511230527.26096-4-zide.chen@intel.com>
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?
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.
> @@ -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,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260511230527.26096-1-zide.chen@intel.com?part=3
next prev parent reply other threads:[~2026-05-13 2:33 UTC|newest]
Thread overview: 14+ 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-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 [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-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
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=20260513023345.ED78AC2BCB0@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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