]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cpufreq: intel_pstate: Avoid SMP calls to get cpu-type
authorPawan Gupta <pawan.kumar.gupta@linux.intel.com>
Thu, 12 Dec 2024 06:57:30 +0000 (22:57 -0800)
committerIngo Molnar <mingo@kernel.org>
Thu, 27 Feb 2025 12:34:52 +0000 (13:34 +0100)
Intel pstate driver relies on SMP calls to get the cpu-type of a given CPU.
Remove the SMP calls and instead use the cached value of cpu-type which is
more efficient.

[ mingo: Forward ported it. ]

Suggested-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Link: https://lore.kernel.org/r/20241211-add-cpu-type-v5-2-2ae010f50370@linux.intel.com
drivers/cpufreq/intel_pstate.c

index 9c4cc01fd51aadc3c7d4a5870033e0f851c7a42a..f06b9bc9994564c910249327115b98e58595cd2f 100644 (file)
@@ -2200,28 +2200,20 @@ static int knl_get_turbo_pstate(int cpu)
        return ret;
 }
 
-static void hybrid_get_type(void *data)
-{
-       u8 *cpu_type = data;
-
-       *cpu_type = get_this_hybrid_cpu_type();
-}
-
 static int hwp_get_cpu_scaling(int cpu)
 {
        if (hybrid_scaling_factor) {
-               u8 cpu_type = 0;
-
-               smp_call_function_single(cpu, hybrid_get_type, &cpu_type, 1);
+               struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
+               u8 cpu_type = c->topo.intel_type;
 
                /*
                 * Return the hybrid scaling factor for P-cores and use the
                 * default core scaling for E-cores.
                 */
-               if (cpu_type == 0x40)
+               if (cpu_type == INTEL_CPU_TYPE_CORE)
                        return hybrid_scaling_factor;
 
-               if (cpu_type == 0x20)
+               if (cpu_type == INTEL_CPU_TYPE_ATOM)
                        return core_get_scaling();
        }