linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: Enable HWP by default
@ 2016-02-25 23:09 Srinivas Pandruvada
  2016-02-25 23:19 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2016-02-25 23:09 UTC (permalink / raw)
  To: rjw, len.brown; +Cc: linux-pm, Srinivas Pandruvada

If the processor supports HWP, enable it by default without checking
for the cpu model. This will allow to enable HWP in all supported
processors without driver change.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/cpufreq/intel_pstate.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 80ea548..0eca72a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1374,6 +1374,11 @@ static inline bool intel_pstate_platform_pwr_mgmt_exists(void) { return false; }
 static inline bool intel_pstate_has_acpi_ppc(void) { return false; }
 #endif /* CONFIG_ACPI */
 
+static const struct x86_cpu_id hwp_support_ids[] __initconst = {
+	{ X86_VENDOR_INTEL, 6, X86_MODEL_ANY, X86_FEATURE_HWP },
+	{}
+};
+
 static int __init intel_pstate_init(void)
 {
 	int cpu, rc = 0;
@@ -1383,17 +1388,16 @@ static int __init intel_pstate_init(void)
 	if (no_load)
 		return -ENODEV;
 
+	if (x86_match_cpu(hwp_support_ids) && !no_hwp) {
+		copy_cpu_funcs(&core_params.funcs);
+		hwp_active++;
+		goto hwp_cpu_matched;
+	}
+
 	id = x86_match_cpu(intel_pstate_cpu_ids);
 	if (!id)
 		return -ENODEV;
 
-	/*
-	 * The Intel pstate driver will be ignored if the platform
-	 * firmware has its own power management modes.
-	 */
-	if (intel_pstate_platform_pwr_mgmt_exists())
-		return -ENODEV;
-
 	cpu_def = (struct cpu_defaults *)id->driver_data;
 
 	copy_pid_params(&cpu_def->pid_policy);
@@ -1402,17 +1406,20 @@ static int __init intel_pstate_init(void)
 	if (intel_pstate_msrs_not_valid())
 		return -ENODEV;
 
+hwp_cpu_matched:
+	/*
+	 * The Intel pstate driver will be ignored if the platform
+	 * firmware has its own power management modes.
+	 */
+	if (intel_pstate_platform_pwr_mgmt_exists())
+		return -ENODEV;
+
 	pr_info("Intel P-state driver initializing.\n");
 
 	all_cpu_data = vzalloc(sizeof(void *) * num_possible_cpus());
 	if (!all_cpu_data)
 		return -ENOMEM;
 
-	if (static_cpu_has_safe(X86_FEATURE_HWP) && !no_hwp) {
-		pr_info("intel_pstate: HWP enabled\n");
-		hwp_active++;
-	}
-
 	if (!hwp_active && hwp_only)
 		goto out;
 
@@ -1423,6 +1430,9 @@ static int __init intel_pstate_init(void)
 	intel_pstate_debug_expose_params();
 	intel_pstate_sysfs_expose_params();
 
+	if (hwp_active)
+		pr_info("intel_pstate: HWP enabled\n");
+
 	return rc;
 out:
 	get_online_cpus();
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Enable HWP by default
  2016-02-25 23:09 [PATCH] cpufreq: intel_pstate: Enable HWP by default Srinivas Pandruvada
@ 2016-02-25 23:19 ` Rafael J. Wysocki
  2016-02-25 23:33   ` Srinivas Pandruvada
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-02-25 23:19 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: len.brown, linux-pm

On Thursday, February 25, 2016 03:09:19 PM Srinivas Pandruvada wrote:
> If the processor supports HWP, enable it by default without checking
> for the cpu model. This will allow to enable HWP in all supported
> processors without driver change.
> 
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

Isn't that a bit risky in the face of recent experience?

Rafael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Enable HWP by default
  2016-02-25 23:19 ` Rafael J. Wysocki
@ 2016-02-25 23:33   ` Srinivas Pandruvada
  2016-02-27  0:02     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Srinivas Pandruvada @ 2016-02-25 23:33 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: len.brown, linux-pm

On Fri, 2016-02-26 at 00:19 +0100, Rafael J. Wysocki wrote:
> On Thursday, February 25, 2016 03:09:19 PM Srinivas Pandruvada wrote:
> > If the processor supports HWP, enable it by default without
> > checking
> > for the cpu model. This will allow to enable HWP in all supported
> > processors without driver change.
> > 
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel
> > .com>
> 
> Isn't that a bit risky in the face of recent experience?
Good question. The current systems which are commercial, already have
cpuid added in our list, so HWP will be enabled anyway.
The one system we know there is an issue, hope we can debug before
merge window start.
If I don't do, I have to add few more ids to the list.

Let's wait for few more weeks to review and merge this. I will let
anybody from the community comment, who are using Skylake.

Thanks,
Srinivas

> 
> Rafael
> 
> --
> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cpufreq: intel_pstate: Enable HWP by default
  2016-02-25 23:33   ` Srinivas Pandruvada
@ 2016-02-27  0:02     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-02-27  0:02 UTC (permalink / raw)
  To: Srinivas Pandruvada; +Cc: len.brown, linux-pm

On Thursday, February 25, 2016 03:33:51 PM Srinivas Pandruvada wrote:
> On Fri, 2016-02-26 at 00:19 +0100, Rafael J. Wysocki wrote:
> > On Thursday, February 25, 2016 03:09:19 PM Srinivas Pandruvada wrote:
> > > If the processor supports HWP, enable it by default without
> > > checking
> > > for the cpu model. This will allow to enable HWP in all supported
> > > processors without driver change.
> > > 
> > > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel
> > > .com>
> > 
> > Isn't that a bit risky in the face of recent experience?
> Good question. The current systems which are commercial, already have
> cpuid added in our list, so HWP will be enabled anyway.
> The one system we know there is an issue, hope we can debug before
> merge window start.
> If I don't do, I have to add few more ids to the list.
> 
> Let's wait for few more weeks to review and merge this. I will let
> anybody from the community comment, who are using Skylake.

I've queued up the patch for 4.6 to expose it a bit more.

It may stay in linux-next for now and I can always drop it if need be.

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-27  0:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 23:09 [PATCH] cpufreq: intel_pstate: Enable HWP by default Srinivas Pandruvada
2016-02-25 23:19 ` Rafael J. Wysocki
2016-02-25 23:33   ` Srinivas Pandruvada
2016-02-27  0:02     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).