diff mbox

intel_pstate: enable hwp per cpu

Message ID 1436892383-4217-1-git-send-email-kristen@linux.intel.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show

Commit Message

Kristen Carlson Accardi July 14, 2015, 4:46 p.m. UTC
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.

Signed-off-by:  Kristen Carlson Accardi <kristen@linux.intel.com>
Tested-by: David Zhuang <david.zhuang@oracle.com>
---
 drivers/cpufreq/intel_pstate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Kristen Carlson Accardi July 14, 2015, 5:58 p.m. UTC | #1
On Tue, 14 Jul 2015 09:46:23 -0700
Kristen Carlson Accardi <kristen@linux.intel.com> wrote:

> 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.
> 
> Signed-off-by:  Kristen Carlson Accardi <kristen@linux.intel.com>
> Tested-by: David Zhuang <david.zhuang@oracle.com>

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

Sorry for the noise,
Kristen

> ---
>  drivers/cpufreq/intel_pstate.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 15ada47..763d8f3 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -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;

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chen Yu July 15, 2015, 11:17 a.m. UTC | #2
On Wed, Jul 15, 2015 at 1:58 AM, Kristen Carlson Accardi
<kristen@linux.intel.com> wrote:

>
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kristen Carlson Accardi July 15, 2015, 2:41 p.m. UTC | #3
On Wed, 15 Jul 2015 19:17:53 +0800
yu chen <yu.chen.surf@gmail.com> wrote:

> On Wed, Jul 15, 2015 at 1:58 AM, Kristen Carlson Accardi
> <kristen@linux.intel.com> wrote:
> 
> >
> > 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

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

Thanks,
Kristen
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rafael J. Wysocki July 16, 2015, 12:36 a.m. UTC | #4
On Wednesday, July 15, 2015 07:41:45 AM Kristen Carlson Accardi wrote:
> On Wed, 15 Jul 2015 19:17:53 +0800
> yu chen <yu.chen.surf@gmail.com> wrote:
> 
> > On Wed, Jul 15, 2015 at 1:58 AM, Kristen Carlson Accardi
> > <kristen@linux.intel.com> wrote:
> > 
> > >
> > > 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
> 
> Ok.  Rafael, would you mind applying the patch after all?  False
> alarm :).

OK, queuing up for 4.3, thanks!
diff mbox

Patch

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 15ada47..763d8f3 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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;