diff mbox

[7/9] SQUASH: cpufreq/intel_pstate: Enable LP controller based on ACPI FADT profile.

Message ID 20180328063845.4884-8-currojerez@riseup.net (mailing list archive)
State New, archived
Headers show

Commit Message

Francisco Jerez March 28, 2018, 6:38 a.m. UTC
This is provided at Srinivas' request.  The LP controller is disabled
for the moment on server FADT profiles in order to avoid disturbing
the performance behavior of small-core servers.  In cases where the
default inferred from the BIOS FADT profile is suboptimal, the LP
controller can be forcefully enabled or disabled by passing
"intel_pstate=lp" or "intel_pstate=no_lp" respectively in the kernel
command line.

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
---
 Documentation/admin-guide/kernel-parameters.txt |  6 +++++
 Documentation/admin-guide/pm/intel_pstate.rst   |  7 ++++++
 drivers/cpufreq/intel_pstate.c                  | 32 ++++++++++++++++++++++++-
 3 files changed, 44 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 1d1d53f85ddd..0ba112696938 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -1681,6 +1681,12 @@ 
 		per_cpu_perf_limits
 			Allow per-logical-CPU P-State performance control limits using
 			cpufreq sysfs interface
+		lp
+			Force use of LP P-state controller.  Overrides selection
+			derived from ACPI FADT profile.  Has no effect if HWP is
+			available.
+		no_lp
+			Prevent use of LP P-state controller (see "lp" parameter).
 
 	intremap=	[X86-64, Intel-IOMMU]
 			on	enable Interrupt Remapping (default)
diff --git a/Documentation/admin-guide/pm/intel_pstate.rst b/Documentation/admin-guide/pm/intel_pstate.rst
index d2b6fda3d67b..a5885fc4c039 100644
--- a/Documentation/admin-guide/pm/intel_pstate.rst
+++ b/Documentation/admin-guide/pm/intel_pstate.rst
@@ -642,6 +642,13 @@  of them have to be prepended with the ``intel_pstate=`` prefix.
 	Use per-logical-CPU P-State limits (see `Coordination of P-state
 	Limits`_ for details).
 
+``lp``
+	Force use of LP P-state controller.  Overrides selection derived
+	from ACPI FADT profile.  Has no effect if HWP is available.
+
+``no_lp``
+	Prevent use of LP P-state controller (see "lp" parameter).
+
 
 Diagnostics and Tuning
 ======================
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index d4b5d0aaa282..d0e212387755 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2485,6 +2485,7 @@  static int intel_pstate_update_status(const char *buf, size_t size)
 
 static int no_load __initdata;
 static int no_hwp __initdata;
+static int no_lp __initdata;
 static int hwp_only __initdata;
 static unsigned int force_load __initdata;
 
@@ -2507,8 +2508,12 @@  static void __init copy_cpu_funcs(struct pstate_funcs *funcs)
 	pstate_funcs.get_scaling = funcs->get_scaling;
 	pstate_funcs.get_val   = funcs->get_val;
 	pstate_funcs.get_vid   = funcs->get_vid;
-	pstate_funcs.update_util = funcs->update_util;
 	pstate_funcs.get_aperf_mperf_shift = funcs->get_aperf_mperf_shift;
+
+	if (no_lp)
+		pstate_funcs.update_util = intel_pstate_update_util;
+	else
+		pstate_funcs.update_util = funcs->update_util;
 }
 
 #ifdef CONFIG_ACPI
@@ -2690,6 +2695,25 @@  static int __init intel_pstate_init(void)
 }
 device_initcall(intel_pstate_init);
 
+#ifdef CONFIG_ACPI
+static bool __init is_server_acpi_profile(void)
+{
+	switch (acpi_gbl_FADT.preferred_profile) {
+	case PM_ENTERPRISE_SERVER:
+	case PM_SOHO_SERVER:
+	case PM_PERFORMANCE_SERVER:
+		return true;
+	default:
+		return false;
+	}
+}
+#else
+static bool __init is_server_acpi_profile(void)
+{
+	return false;
+}
+#endif
+
 static int __init intel_pstate_setup(char *str)
 {
 	if (!str)
@@ -2713,6 +2737,12 @@  static int __init intel_pstate_setup(char *str)
 	if (!strcmp(str, "per_cpu_perf_limits"))
 		per_cpu_limits = true;
 
+	no_lp = is_server_acpi_profile();
+	if (!strcmp(str, "lp"))
+		no_lp = 0;
+	if (!strcmp(str, "no_lp"))
+		no_lp = 1;
+
 #ifdef CONFIG_ACPI
 	if (!strcmp(str, "support_acpi_ppc"))
 		acpi_ppc = true;