Skip to contentSkip to conversation

intel_pstate: allow to be built as module and handle Sun server power capping.

PATCH In review Ethan Zhao 1 participant 9 messages Nov 18, 2014

Subsystems (3)
lore
Share & tools
lore

Ethan Zhao

author
#0 lore raw

PATCH 1/1 intel_pstate: allow to be built as module and handle Sun server power capping.

Oracle Sun servers(X86) have power capping features that work via ACPI _PPC method,
patch No.1 is used to skip this driver if Oracle Sun server and _PPC detected. patch No.2 is used to allow the driver to be configured and built as a module, so provide the flexibility of configuration by userland. patch No.3 introduce a module parameter and a kernel command line parameter, let user could force it loaded even on Oracle Sun Servers(X86), that will be useful for debug\test\workaround etc purpose.

These patches have been tested on Oracle Sun server X4-2 series with following cases on stable v3.18-rc3.

a. Configure and build intel_pstate as builtin.
Boot without any kernel line parameter.
Boot with intel_pstate=ignore_acpi_ppc.
b. Configure and build intel_pstate as module.
Load intel_pstate drive without any module parameter. Load intel_pstate driver with ignore_acpi_ppc=1

These cases passed and work fine.
--
Brian Maly (1):
intel_pstate: allow driver to be built as a module

Ethan Zhao (2):
intel_pstate: skip the driver if Sun server has ACPI _PPC method
intel_pstate: add module and kernel command line parameter to ignore
ACPI _PPC

 Documentation/kernel-parameters.txt |  3 +++
 drivers/cpufreq/Kconfig.x86         |  2 +-
 drivers/cpufreq/intel_pstate.c      | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 intel_pstate: skip the driver if Sun server has ACPI _PPC method

Oracle Sun X86 servers have dynamic power capping capability that works via ACPI _PPC method etc, so skip loading this driver if Sun server has ACPI _PPC enabled.

---
 drivers/cpufreq/intel_pstate.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/cpufreq/intel_pstate.c +20 -0
index 27bb6d3..5498eb0 100644
@@ -943,6 +943,21 @@ static bool intel_pstate_no_acpi_pss(void)
 	return true;
 }
 
+static bool intel_pstate_has_acpi_ppc(void)
+{
+	int i;
+
+	for_each_possible_cpu(i) {
+		struct acpi_processor *pr = per_cpu(processors, i);
+
+		if (!pr)
+			continue;
+		if (acpi_has_method(pr->handle, "_PPC"))
+			return true;
+	}
+	return false;
+}
+
 struct hw_vendor_info {
 	u16  valid;
 	char oem_id[ACPI_OEM_ID_SIZE];
@@ -952,6 +967,7 @@ struct hw_vendor_info {
 /* Hardware vendor-specific info that has its own power management modes */
 static struct hw_vendor_info vendor_info[] = {
 	{1, "HP    ", "ProLiant"},
+	{1, "ORACLE", ""},
 	{0, "", ""},
 };
 
@@ -969,12 +985,16 @@ static bool intel_pstate_platform_pwr_mgmt_exists(void)
 		    !strncmp(hdr.oem_table_id, v_info->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
 		    intel_pstate_no_acpi_pss())
 			return true;
+		if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE) &&
+			intel_pstate_has_acpi_ppc())
+			return true;
 	}
 
 	return false;
 }
 #else /* CONFIG_ACPI not enabled */
 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 int __init intel_pstate_init(void)
Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH 1/1 intel_pstate: add module and kernel command line parameter to ignore ACPI _PPC

In reply to Ethan Zhao

Add kernel command line parameter
intel_pstate = ignore_acpi_ppc
and module parameter
ignore_acpi_ppc = 1
to allow driver to ignore the ACPI _PPC existence even for Sun x86 servers. These parameter could be used for debug\test\workaround etc purpose.

---
 Documentation/kernel-parameters.txt | 3 +++
 drivers/cpufreq/intel_pstate.c      | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +3 -0
index 4c81a86..f502b85 100644
@@ -1446,6 +1446,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 		       disable
 		         Do not enable intel_pstate as the default
 		         scaling driver for the supported processors
+		       ignore_acpi_ppc
+			 Ignore the existence of ACPI method _PPC for Sun x86 servers
+			 and load the driver.
 
 	intremap=	[X86-64, Intel-IOMMU]
 			on	enable Interrupt Remapping (default)
drivers/cpufreq/intel_pstate.c +7 -1
index 7c5faea..388387b 100644
@@ -870,6 +870,7 @@ static struct cpufreq_driver intel_pstate_driver = {
 };
 
 static int __initdata no_load;
+static unsigned int  ignore_acpi_ppc;
 
 static int intel_pstate_msrs_not_valid(void)
 {
@@ -990,7 +991,7 @@ static bool intel_pstate_platform_pwr_mgmt_exists(void)
 		    intel_pstate_no_acpi_pss())
 			return true;
 		if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE) &&
-			intel_pstate_has_acpi_ppc())
+			intel_pstate_has_acpi_ppc() && !ignore_acpi_ppc)
 			return true;
 	}
 
@@ -1066,11 +1067,16 @@ static int __init intel_pstate_setup(char *str)
 
 	if (!strcmp(str, "disable"))
 		no_load = 1;
+	if (!strcmp(str, "ignore_acpi_ppc"))
+		ignore_acpi_ppc = 1;
 	return 0;
 }
 early_param("intel_pstate", intel_pstate_setup);
 #endif
 
+module_param(ignore_acpi_ppc, uint, 0644);
+MODULE_PARM_DESC(ignore_acpi_ppc,
+	"value 0 or non-zero. non-zero -> ignore ACPI _PPC and load this driver");
 MODULE_AUTHOR("Dirk Brandewie <[email protected]>");
 MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.8.3.1
author
#3 lore raw

PATCH 1/1 intel_pstate: allow to be built as module and handle Sun server power capping.

In reply to Ethan Zhao

Oracle Sun servers(X86) have power capping features that work via ACPI _PPC method,
patch No.1 is used to skip this driver if Oracle Sun server and _PPC detected. patch No.2 is used to allow the driver to be configured and built as a module, so provide the flexibility of configuration by userland. patch No.3 introduce a module parameter and a kernel command line parameter, let user could force it loaded even on Oracle Sun Servers(X86), that will be useful for debug\test\workaround etc purpose.

These patches have been tested on Oracle Sun server X4-2 series with following cases on stable v3.18-rc3.

a. Configure and build intel_pstate as builtin.
Boot without any kernel line parameter.
Boot with intel_pstate=ignore_acpi_ppc.
b. Configure and build intel_pstate as module.
Load intel_pstate drive without any module parameter. Load intel_pstate driver with ignore_acpi_ppc=1

These cases passed and work fine.
--
Brian Maly (1):
intel_pstate: allow driver to be built as a module

Ethan Zhao (2):
intel_pstate: skip the driver if Sun server has ACPI _PPC method
intel_pstate: add module and kernel command line parameter to ignore
ACPI _PPC

 Documentation/kernel-parameters.txt |  3 +++
 drivers/cpufreq/Kconfig.x86         |  2 +-
 drivers/cpufreq/intel_pstate.c      | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.3.1
author
#4 lore raw

PATCH 1/1 intel_pstate: allow driver to be built as a module

In reply to Ethan Zhao

From: Brian Maly <[email protected]>

To provide the flexibility of module, allow this driver to be configured and built as a module.

---
 drivers/cpufreq/Kconfig.x86    | 2 +-
 drivers/cpufreq/intel_pstate.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/cpufreq/Kconfig.x86 +1 -1
index 89ae88f..94c9e6b 100644
@@ -3,7 +3,7 @@
 #
 
 config X86_INTEL_PSTATE
-       bool "Intel P state control"
+       tristate "Intel P state control"
        depends on X86
        help
           This driver provides a P state for Intel core processors.
drivers/cpufreq/intel_pstate.c +6 -0
index 5498eb0..7c5faea 100644
@@ -590,7 +590,9 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
 	if (pstate == cpu->pstate.current_pstate)
 		return;
 
+#ifndef MODULE
 	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
+#endif
 
 	cpu->pstate.current_pstate = pstate;
 
@@ -705,12 +707,14 @@ static void intel_pstate_timer_func(unsigned long __data)
 
 	intel_pstate_adjust_busy_pstate(cpu);
 
+#ifndef MODULE
 	trace_pstate_sample(fp_toint(sample->core_pct_busy),
 			fp_toint(intel_pstate_get_scaled_busy(cpu)),
 			cpu->pstate.current_pstate,
 			sample->mperf,
 			sample->aperf,
 			sample->freq);
+#endif
 
 	intel_pstate_set_sample_time(cpu);
 }
@@ -1054,6 +1058,7 @@ out:
 }
 device_initcall(intel_pstate_init);
 
+#ifndef MODULE
 static int __init intel_pstate_setup(char *str)
 {
 	if (!str)
@@ -1064,6 +1069,7 @@ static int __init intel_pstate_setup(char *str)
 	return 0;
 }
 early_param("intel_pstate", intel_pstate_setup);
+#endif
 
 MODULE_AUTHOR("Dirk Brandewie <[email protected]>");
 MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");
Signature · 1 line
1.8.3.1
author
#5 lore raw

PATCH 1/1 intel_pstate: add module and kernel command line parameter to ignore ACPI _PPC

In reply to Ethan Zhao

Add kernel command line parameter
intel_pstate = ignore_acpi_ppc
and module parameter
ignore_acpi_ppc = 1
to allow driver to ignore the ACPI _PPC existence even for Sun x86 servers. These parameter could be used for debug\test\workaround etc purpose.

---
 Documentation/kernel-parameters.txt | 3 +++
 drivers/cpufreq/intel_pstate.c      | 8 +++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
Documentation/kernel-parameters.txt +3 -0
index 4c81a86..f502b85 100644
@@ -1446,6 +1446,9 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 		       disable
 		         Do not enable intel_pstate as the default
 		         scaling driver for the supported processors
+		       ignore_acpi_ppc
+			 Ignore the existence of ACPI method _PPC for Sun x86 servers
+			 and load the driver.
 
 	intremap=	[X86-64, Intel-IOMMU]
 			on	enable Interrupt Remapping (default)
drivers/cpufreq/intel_pstate.c +7 -1
index 7c5faea..388387b 100644
@@ -870,6 +870,7 @@ static struct cpufreq_driver intel_pstate_driver = {
 };
 
 static int __initdata no_load;
+static unsigned int  ignore_acpi_ppc;
 
 static int intel_pstate_msrs_not_valid(void)
 {
@@ -990,7 +991,7 @@ static bool intel_pstate_platform_pwr_mgmt_exists(void)
 		    intel_pstate_no_acpi_pss())
 			return true;
 		if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE) &&
-			intel_pstate_has_acpi_ppc())
+			intel_pstate_has_acpi_ppc() && !ignore_acpi_ppc)
 			return true;
 	}
 
@@ -1066,11 +1067,16 @@ static int __init intel_pstate_setup(char *str)
 
 	if (!strcmp(str, "disable"))
 		no_load = 1;
+	if (!strcmp(str, "ignore_acpi_ppc"))
+		ignore_acpi_ppc = 1;
 	return 0;
 }
 early_param("intel_pstate", intel_pstate_setup);
 #endif
 
+module_param(ignore_acpi_ppc, uint, 0644);
+MODULE_PARM_DESC(ignore_acpi_ppc,
+	"value 0 or non-zero. non-zero -> ignore ACPI _PPC and load this driver");
 MODULE_AUTHOR("Dirk Brandewie <[email protected]>");
 MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");
 MODULE_LICENSE("GPL");
Signature · 1 line
1.8.3.1
author
#6 lore raw

PATCH 1/1 intel_pstate: allow driver to be built as a module

In reply to Ethan Zhao

From: Brian Maly <[email protected]>

To provide the flexibility of module, allow this driver to be configured and built as a module.

---
 drivers/cpufreq/Kconfig.x86    | 2 +-
 drivers/cpufreq/intel_pstate.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/cpufreq/Kconfig.x86 +1 -1
index 89ae88f..94c9e6b 100644
@@ -3,7 +3,7 @@
 #
 
 config X86_INTEL_PSTATE
-       bool "Intel P state control"
+       tristate "Intel P state control"
        depends on X86
        help
           This driver provides a P state for Intel core processors.
drivers/cpufreq/intel_pstate.c +6 -0
index 5498eb0..7c5faea 100644
@@ -590,7 +590,9 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
 	if (pstate == cpu->pstate.current_pstate)
 		return;
 
+#ifndef MODULE
 	trace_cpu_frequency(pstate * cpu->pstate.scaling, cpu->cpu);
+#endif
 
 	cpu->pstate.current_pstate = pstate;
 
@@ -705,12 +707,14 @@ static void intel_pstate_timer_func(unsigned long __data)
 
 	intel_pstate_adjust_busy_pstate(cpu);
 
+#ifndef MODULE
 	trace_pstate_sample(fp_toint(sample->core_pct_busy),
 			fp_toint(intel_pstate_get_scaled_busy(cpu)),
 			cpu->pstate.current_pstate,
 			sample->mperf,
 			sample->aperf,
 			sample->freq);
+#endif
 
 	intel_pstate_set_sample_time(cpu);
 }
@@ -1054,6 +1058,7 @@ out:
 }
 device_initcall(intel_pstate_init);
 
+#ifndef MODULE
 static int __init intel_pstate_setup(char *str)
 {
 	if (!str)
@@ -1064,6 +1069,7 @@ static int __init intel_pstate_setup(char *str)
 	return 0;
 }
 early_param("intel_pstate", intel_pstate_setup);
+#endif
 
 MODULE_AUTHOR("Dirk Brandewie <[email protected]>");
 MODULE_DESCRIPTION("'intel_pstate' - P state driver Intel Core processors");
Signature · 1 line
1.8.3.1
author
#7 lore raw

PATCH 1/1 intel_pstate: skip the driver if Sun server has ACPI _PPC method

In reply to Ethan Zhao

Oracle Sun X86 servers have dynamic power capping capability that works via ACPI _PPC method etc, so skip loading this driver if Sun server has ACPI _PPC enabled.

---
 drivers/cpufreq/intel_pstate.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/cpufreq/intel_pstate.c +20 -0
index 27bb6d3..5498eb0 100644
@@ -943,6 +943,21 @@ static bool intel_pstate_no_acpi_pss(void)
 	return true;
 }
 
+static bool intel_pstate_has_acpi_ppc(void)
+{
+	int i;
+
+	for_each_possible_cpu(i) {
+		struct acpi_processor *pr = per_cpu(processors, i);
+
+		if (!pr)
+			continue;
+		if (acpi_has_method(pr->handle, "_PPC"))
+			return true;
+	}
+	return false;
+}
+
 struct hw_vendor_info {
 	u16  valid;
 	char oem_id[ACPI_OEM_ID_SIZE];
@@ -952,6 +967,7 @@ struct hw_vendor_info {
 /* Hardware vendor-specific info that has its own power management modes */
 static struct hw_vendor_info vendor_info[] = {
 	{1, "HP    ", "ProLiant"},
+	{1, "ORACLE", ""},
 	{0, "", ""},
 };
 
@@ -969,12 +985,16 @@ static bool intel_pstate_platform_pwr_mgmt_exists(void)
 		    !strncmp(hdr.oem_table_id, v_info->oem_table_id, ACPI_OEM_TABLE_ID_SIZE) &&
 		    intel_pstate_no_acpi_pss())
 			return true;
+		if (!strncmp(hdr.oem_id, v_info->oem_id, ACPI_OEM_ID_SIZE) &&
+			intel_pstate_has_acpi_ppc())
+			return true;
 	}
 
 	return false;
 }
 #else /* CONFIG_ACPI not enabled */
 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 int __init intel_pstate_init(void)
Signature · 1 line
1.8.3.1
author
#8 lore raw
In reply to Ethan Zhao

Sorry, I missed the -n to git format-patch,
please ignore this patch.

Thanks,
Ethan

Quoted 32 lines · Ethan Zhao

Oracle Sun servers(X86) have power capping features that work via ACPI _PPC method,
patch No.1 is used to skip this driver if Oracle Sun server and _PPC detected. patch No.2 is used to allow the driver to be configured and built as a module, so provide the flexibility of configuration by userland. patch No.3 introduce a module parameter and a kernel command line parameter, let user could force it loaded even on Oracle Sun Servers(X86), that will be useful for debug\test\workaround etc purpose.

These patches have been tested on Oracle Sun server X4-2 series with following cases on stable v3.18-rc3.

a. Configure and build intel_pstate as builtin.
Boot without any kernel line parameter.
Boot with intel_pstate=ignore_acpi_ppc.
b. Configure and build intel_pstate as module.
Load intel_pstate drive without any module parameter. Load intel_pstate driver with ignore_acpi_ppc=1

These cases passed and work fine.
--
Brian Maly (1):
intel_pstate: allow driver to be built as a module

Ethan Zhao (2):
intel_pstate: skip the driver if Sun server has ACPI _PPC method
intel_pstate: add module and kernel command line parameter to ignore
ACPI _PPC

  Documentation/kernel-parameters.txt |  3 +++
  drivers/cpufreq/Kconfig.x86         |  2 +-
  drivers/cpufreq/intel_pstate.c      | 32 ++++++++++++++++++++++++++++++++
  3 files changed, 36 insertions(+), 1 deletion(-)