Re: [PATCH PATCH 3/9] perf/x86/intel: Use topology_cpu_type() to get cpu-type
From: Pawan Gupta
Date: Mon Jun 17 2024 - 14:10:42 EST
On Mon, Jun 17, 2024 at 07:50:53AM -0700, Dave Hansen wrote:
> On 6/17/24 02:11, Pawan Gupta wrote:
> > find_hybrid_pmu_for_cpu() uses get_this_hybrid_cpu_type() to get the CPU
> > type, but it returns an invalid cpu-type when X86_FEATURE_HYBRID_CPU is not
> > set. Some hybrid variants do enumerate cpu-type regardless of
> > X86_FEATURE_HYBRID_CPU.
>
> I'm not fully sure what point this is trying to make.
Sorry it was not clear. I will rephrase it.
> Is this trying to make the case that get_this_hybrid_cpu_type() and
> topology_cpu_type() are equivalent or pointing out a difference?
Pointing out a difference. get_this_hybrid_cpu_type() misses a case when
cpu-type is enumerated regardless of X86_FEATURE_HYBRID_CPU. I don't think
checking for the hybrid feature is necessary here, because there is an
existing fixup for this case:
static struct x86_hybrid_pmu *find_hybrid_pmu_for_cpu(void)
{
u8 cpu_type = topology_cpu_type(smp_processor_id());
int i;
/*
* This is running on a CPU model that is known to have hybrid
* configurations. But the CPU told us it is not hybrid, shame
* on it. There should be a fixup function provided for these
* troublesome CPUs (->get_hybrid_cpu_type).
*/
if (cpu_type == HYBRID_INTEL_NONE) {
if (x86_pmu.get_hybrid_cpu_type)
cpu_type = x86_pmu.get_hybrid_cpu_type();
else
return NULL;
}