Skip to contentSkip to conversation

intel_pstate: enable hwp per cpu

PATCH In review Kristen Carlson Accardi 3 participants 5 messages Jul 14, 2015 – Jul 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_pstate: enable hwp per cpu

HWP previously was only enabled at driver load time, on the boot cpu, however, HWP must be enabled per package. Move the code to enable HWP to the cpufreq driver init path so that it will be called per cpu.

---
 drivers/cpufreq/intel_pstate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/intel_pstate.c +7 -4
index 15ada47..763d8f3 100644
@@ -484,12 +484,11 @@ static void __init intel_pstate_sysfs_expose_params(void)
 }
 /************************** sysfs end ************************/
 
-static void intel_pstate_hwp_enable(void)
+static void intel_pstate_hwp_enable(struct cpudata *cpudata)
 {
-	hwp_active++;
 	pr_info("intel_pstate: HWP enabled\n");
 
-	wrmsrl( MSR_PM_ENABLE, 0x1);
+	wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
 }
 
 static int byt_get_min_pstate(void)
@@ -932,6 +931,10 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 	cpu = all_cpu_data[cpunum];
 
 	cpu->cpu = cpunum;
+
+	if (hwp_active)
+		intel_pstate_hwp_enable(cpu);
+
 	intel_pstate_get_cpu_pstates(cpu);
 
 	init_timer_deferrable(&cpu->timer);
@@ -1245,7 +1248,7 @@ static int __init intel_pstate_init(void)
 		return -ENOMEM;
 
 	if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp)
-		intel_pstate_hwp_enable();
+		hwp_active++;
 
 	if (!hwp_active && hwp_only)
 		goto out;
Signature · 1 line
2.4.3
#1 lore raw
Quoted 7 lines · On Tue, 14 Jul 2015 09:46:23 -0700 Kristen Carlson Accardi…

HWP previously was only enabled at driver load time, on the boot cpu, however, HWP must be enabled per package. Move the code to enable HWP to the cpufreq driver init path so that it will be called per cpu.

Oops - don't apply this one yet please. I think I might have broken S3 resume.

Sorry for the noise,
Kristen

Quoted 43 lines
---
 drivers/cpufreq/intel_pstate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/intel_pstate.c +7 -4
index 15ada47..763d8f3 100644
@@ -484,12 +484,11 @@ static void __init intel_pstate_sysfs_expose_params(void)
 }
 /************************** sysfs end ************************/
 
-static void intel_pstate_hwp_enable(void)
+static void intel_pstate_hwp_enable(struct cpudata *cpudata)
 {
-	hwp_active++;
 	pr_info("intel_pstate: HWP enabled\n");
 
-	wrmsrl( MSR_PM_ENABLE, 0x1);
+	wrmsrl_on_cpu(cpudata->cpu, MSR_PM_ENABLE, 0x1);
 }
 
 static int byt_get_min_pstate(void)
@@ -932,6 +931,10 @@ static int intel_pstate_init_cpu(unsigned int cpunum)
 	cpu = all_cpu_data[cpunum];
 
 	cpu->cpu = cpunum;
+
+	if (hwp_active)
+		intel_pstate_hwp_enable(cpu);
+
 	intel_pstate_get_cpu_pstates(cpu);
 
 	init_timer_deferrable(&cpu->timer);
@@ -1245,7 +1248,7 @@ static int __init intel_pstate_init(void)
 		return -ENOMEM;
 
 	if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp)
-		intel_pstate_hwp_enable();
+		hwp_active++;
 
 	if (!hwp_active && hwp_only)
 		goto out;
#2 lore raw
Quoted 4 lines · Kristen Carlson Accardi

Oops - don't apply this one yet please. I think I might have broken S3 resume.

Hi, Kristen
This patch will fix the S3 resume panic bug.
We encountered panic on kernel without this patch applied last week. After this patch applied, each cpu will get a chance to re-enable HWP in intel_pstate_cpu_init, after resuming.

Yu

#3 lore raw
Quoted 8 lines · On Wed, 15 Jul 2015 19:17:53 +0800 yu chen <[email protected]> wrote:
Quoted 4 lines · Kristen Carlson Accardi

Oops - don't apply this one yet please. I think I might have broken S3 resume.

Quoted 7 lines

Hi, Kristen
This patch will fix the S3 resume panic bug.
We encountered panic on kernel without this patch applied last week. After this patch applied, each cpu will get a chance to re-enable HWP in intel_pstate_cpu_init, after resuming.

Yu

Ok. Rafael, would you mind applying the patch after all? False alarm :).

Thanks,
Kristen

#4 lore raw
Quoted 17 lines · Kristen Carlson Accardi
Quoted 14 lines · On Wed, 15 Jul 2015 19:17:53 +0800 yu chen <[email protected]> wrote:
Quoted 4 lines · Kristen Carlson Accardi

Oops - don't apply this one yet please. I think I might have broken S3 resume.

Hi, Kristen
This patch will fix the S3 resume panic bug.
We encountered panic on kernel without this patch applied last week. After this patch applied, each cpu will get a chance to re-enable HWP in intel_pstate_cpu_init, after resuming.

Quoted 4 lines
Quoted 1 line

Yu

Ok. Rafael, would you mind applying the patch after all? False alarm :).

OK, queuing up for 4.3, thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.