mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Falcon, Thomas" <thomas.falcon@intel.com>
To: "alexander.shishkin@linux.intel.com"
	<alexander.shishkin@linux.intel.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"acme@kernel.org" <acme@kernel.org>,
	"dapeng1.mi@linux.intel.com" <dapeng1.mi@linux.intel.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"Hunter, Adrian" <adrian.hunter@intel.com>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"Rogers, Ian" <irogers@google.com>
Cc: "Chen, Zide" <zide.chen@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-perf-users@vger.kernel.org"
	<linux-perf-users@vger.kernel.org>,
	"Mi, Dapeng1" <dapeng1.mi@intel.com>,
	"Hao, Xudong" <xudong.hao@intel.com>
Subject: Re: [Patch v2 6/7] perf/x86/intel: Fix intel_cap handling on hybrid PMUs
Date: Wed, 15 Jul 2026 14:25:31 +0000	[thread overview]
Message-ID: <173f5864a2d5a9c0af6cf0f795571213b56ce9d0.camel@intel.com> (raw)
In-Reply-To: <20260713082734.3162099-7-dapeng1.mi@linux.intel.com>

On Mon, 2026-07-13 at 16:27 +0800, Dapeng Mi wrote:
> intel_cap (IA32_PERF_CAPABILITIES) updates are currently tied to
> X86_FEATURE_ARCH_PERFMON_EXT, but these are independent feature
> paths.
> As a result, hybrid PMU capability state can be updated under the
> wrong
> condition.
> 
> Also, intel_pmu_broken_perf_cap() is too narrow. Per RPL018, the
> missing
> PERF_METRICS_AVAILABLE bit affects both Raptor Lake and Meteor Lake
> parts, not only the currently covered subset.
> 
> Move intel_cap updates out of the ARCH_PERFMON_EXT-gated path, extend
> intel_pmu_broken_perf_cap() coverage to both RPL and MTL families,
> and
> introduce intel_update_pmu_caps() to centralize PMU capability
> updates.
> 
> Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
> ---
>  arch/x86/events/intel/core.c | 41 ++++++++++++++++++++++++++--------
> --
>  1 file changed, 30 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/events/intel/core.c
> b/arch/x86/events/intel/core.c
> index c418176065f6..bec92163a09f 100644
> --- a/arch/x86/events/intel/core.c
> +++ b/arch/x86/events/intel/core.c
> @@ -6147,8 +6147,15 @@ static void intel_pmu_check_extra_regs(struct
> extra_reg *extra_regs);
>  
>  static inline bool intel_pmu_broken_perf_cap(void)
>  {
> -	/* The Perf Metric (Bit 15) is always cleared */
> -	if (boot_cpu_data.x86_vfm == INTEL_METEORLAKE ||
> +	/*
> +	 * The Perf Metric (Bit 15) is always cleared on P-core of
> +	 * PRL and MTL. Details can be found in RPL018 Errata
> Details.

Typo here. Should be RPL.

Thanks,
Tom

> +	 *
> https://edc.intel.com/content/www/us/en/design/products/platforms/details/raptor-lake-s/13th-generation-core-processor-specification-update/errata-details/
> +	 */
> +	if (boot_cpu_data.x86_vfm == INTEL_RAPTORLAKE ||
> +	    boot_cpu_data.x86_vfm == INTEL_RAPTORLAKE_P ||
> +	    boot_cpu_data.x86_vfm == INTEL_RAPTORLAKE_S ||
> +	    boot_cpu_data.x86_vfm == INTEL_METEORLAKE ||
>  	    boot_cpu_data.x86_vfm == INTEL_METEORLAKE_L)
>  		return true;
>  
> @@ -6183,7 +6190,7 @@ static inline void
> __intel_update_large_pebs_flags(struct pmu *pmu)
>  
>  #define counter_mask(_gp, _fixed) ((_gp) | ((u64)(_fixed) <<
> INTEL_PMC_IDX_FIXED))
>  
> -static void update_pmu_cap(struct pmu *pmu)
> +static void update_pmu_cap_from_perfmonext(struct pmu *pmu)
>  {
>  	unsigned int eax, ebx, ecx, edx;
>  	union cpuid35_eax eax_0;
> @@ -6241,10 +6248,24 @@ static void update_pmu_cap(struct pmu *pmu)
>  		WARN_ON(x86_pmu.arch_pebs == 1);
>  		x86_pmu.arch_pebs = 0;
>  	}
> +}
> +
> +static void intel_update_pmu_caps(struct pmu *pmu)
> +{
> +	if (this_cpu_has(X86_FEATURE_ARCH_PERFMON_EXT))
> +		update_pmu_cap_from_perfmonext(pmu);
>  
> -	if (!intel_pmu_broken_perf_cap()) {
> -		/* Perf Metric (Bit 15) and PEBS via PT (Bit 16) are
> hybrid enumeration */
> -		rdmsrq(MSR_IA32_PERF_CAPABILITIES, hybrid(pmu,
> intel_cap).capabilities);
> +	if (is_hybrid() && this_cpu_has(X86_FEATURE_PDCM)) {
> +		rdmsrq(MSR_IA32_PERF_CAPABILITIES,
> +		       hybrid(pmu, intel_cap).capabilities);
> +
> +		/*
> +		 * Restore perf_metrics on platforms with broken
> +		 * perf_capablities.
> +		 */
> +		if (intel_pmu_broken_perf_cap() &&
> +		    hybrid_pmu(pmu)->pmu_type == hybrid_big)
> +			hybrid(pmu, intel_cap).perf_metrics = 1;
>  	}
>  }
>  
> @@ -6329,9 +6350,7 @@ static bool init_hybrid_pmu(int cpu)
>  	if (!cpumask_empty(&pmu->supported_cpus))
>  		goto end;
>  
> -	if (this_cpu_has(X86_FEATURE_ARCH_PERFMON_EXT))
> -		update_pmu_cap(&pmu->pmu);
> -
> +	intel_update_pmu_caps(&pmu->pmu);
>  	intel_pmu_check_hybrid_pmus(pmu);
>  
>  	if (!check_hw_exists(pmu->cntr_mask, pmu->fixed_cntr_mask))
> {
> @@ -8828,8 +8847,8 @@ __init int intel_pmu_init(void)
>  	 * from the leaf 0xa. The core specific update will be done
> later
>  	 * when a new type is online.
>  	 */
> -	if (!is_hybrid() &&
> boot_cpu_has(X86_FEATURE_ARCH_PERFMON_EXT))
> -		update_pmu_cap(NULL);
> +	if (!is_hybrid())
> +		intel_update_pmu_caps(NULL);
>  
>  	if (x86_pmu.arch_pebs) {
>  		static_call_update(intel_pmu_disable_event_ext,


  reply	other threads:[~2026-07-15 14:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13  8:27 [Patch v2 0/7] perf/x86: Miscellaneous PMU bug fixes and optimizations Dapeng Mi
2026-07-13  8:27 ` [Patch v2 1/7] perf/x86: Unregister PMI handler on PMU init failure Dapeng Mi
2026-07-13  8:27 ` [Patch v2 2/7] perf/x86: Free hybrid state " Dapeng Mi
2026-07-13  8:27 ` [Patch v2 3/7] perf/x86: Guard intel_pmu_cpu_dead() against invalid hybrid PMU casts Dapeng Mi
2026-07-13  8:27 ` [Patch v2 4/7] perf/x86/intel: Unwind cpuc state if PEBS buffer setup fails Dapeng Mi
2026-07-13  8:27 ` [Patch v2 5/7] perf/x86: Remove stale fixed counter helper and fix hybrid PMU access Dapeng Mi
2026-07-13  8:27 ` [Patch v2 6/7] perf/x86/intel: Fix intel_cap handling on hybrid PMUs Dapeng Mi
2026-07-15 14:25   ` Falcon, Thomas [this message]
2026-07-13  8:27 ` [Patch v2 7/7] perf/x86: Optimize ACR handling in match_prev_assignment() Dapeng Mi
2026-07-15  7:27 ` [Patch v2 0/7] perf/x86: Miscellaneous PMU bug fixes and optimizations Mi, Dapeng
2026-07-15 14:52 ` Falcon, Thomas

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=173f5864a2d5a9c0af6cf0f795571213b56ce9d0.camel@intel.com \
    --to=thomas.falcon@intel.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dapeng1.mi@intel.com \
    --cc=dapeng1.mi@linux.intel.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=peterz@infradead.org \
    --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