diff mbox series

[v2,3/9] perf/x86/intel: Use topology_hw_cpu_type()

Message ID 20240627-add-cpu-type-v2-3-f927bde83ad0@linux.intel.com
State New
Headers show
Series [v2,1/9] x86/cpu/topology: Add CPU type to struct cpuinfo_topology | expand

Commit Message

Pawan Gupta June 27, 2024, 8:44 p.m. UTC
get_this_hybrid_cpu_type() misses a case when cpu-type is populated
regardless of X86_FEATURE_HYBRID_CPU. This is particularly true for hybrid
variants that have P or E cores fused off.

Instead use topology_hw_cpu_type() as it does not rely on hybrid feature to
enumerate cpu-type. This can also help avoid the model-specific fixup
get_hybrid_cpu_type().

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
 arch/x86/events/intel/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pawan Gupta July 1, 2024, 5:32 p.m. UTC | #1
On Mon, Jul 01, 2024 at 11:37:26AM +0800, Mi, Dapeng wrote:
> > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> > index d8d715fcc25c..08794668750f 100644
> > --- a/arch/x86/include/asm/processor.h
> > +++ b/arch/x86/include/asm/processor.h
> > @@ -107,7 +107,7 @@ struct cpuinfo_topology {
> >  	u32			l2c_id;
> >  
> >  	// Hardware defined CPU-type
> > -	u8			hw_cpu_type;
> > +	u32			hw_cpu_type;
> 
> Since hw_cpu_type represents the whole EAX right now, it may need to be
> changed to a more generic name, like hw_cpu_model, or others.

Even with whole EAX it still identifies the CPU-type (just more granular).

Since hw_cpu_type will be used by AMD as well, I think it is better to keep
it as is. Interpretation of what hw_cpu_type means can be left to vendor
specific code.
diff mbox series

Patch

diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 38c1b1f1deaa..0da1fd14b0ea 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -4753,7 +4753,7 @@  static void intel_pmu_check_hybrid_pmus(struct x86_hybrid_pmu *pmu)
 
 static struct x86_hybrid_pmu *find_hybrid_pmu_for_cpu(void)
 {
-	u8 cpu_type = get_this_hybrid_cpu_type();
+	u8 cpu_type = topology_hw_cpu_type(smp_processor_id());
 	int i;
 
 	/*