Skip to content

Commit b52aaee

Browse files
pa1guptaIngo Molnar
authored andcommitted
cpufreq: intel_pstate: Avoid SMP calls to get cpu-type
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
1 parent 4a412c7 commit b52aaee

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,28 +2200,20 @@ static int knl_get_turbo_pstate(int cpu)
22002200
return ret;
22012201
}
22022202

2203-
static void hybrid_get_type(void *data)
2204-
{
2205-
u8 *cpu_type = data;
2206-
2207-
*cpu_type = get_this_hybrid_cpu_type();
2208-
}
2209-
22102203
static int hwp_get_cpu_scaling(int cpu)
22112204
{
22122205
if (hybrid_scaling_factor) {
2213-
u8 cpu_type = 0;
2214-
2215-
smp_call_function_single(cpu, hybrid_get_type, &cpu_type, 1);
2206+
struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
2207+
u8 cpu_type = c->topo.intel_type;
22162208

22172209
/*
22182210
* Return the hybrid scaling factor for P-cores and use the
22192211
* default core scaling for E-cores.
22202212
*/
2221-
if (cpu_type == 0x40)
2213+
if (cpu_type == INTEL_CPU_TYPE_CORE)
22222214
return hybrid_scaling_factor;
22232215

2224-
if (cpu_type == 0x20)
2216+
if (cpu_type == INTEL_CPU_TYPE_ATOM)
22252217
return core_get_scaling();
22262218
}
22272219

0 commit comments

Comments
 (0)