2014-11-18 08:28:36

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] 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(-)

--
1.8.3.1


2014-11-18 08:28:41

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] intel_pstate: allow driver to be built as a module

From: Brian Maly <[email protected]>

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

Signed-off-by: Brian Maly <[email protected]>
Signed-off-by: Ethan Zhao <[email protected]>
---
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/cpufreq/intel_pstate.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 89ae88f..94c9e6b 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -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.
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 5498eb0..7c5faea 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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");
--
1.8.3.1

2014-11-18 08:28:49

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] 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(-)

--
1.8.3.1

2014-11-18 08:28:57

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] intel_pstate: allow driver to be built as a module

From: Brian Maly <[email protected]>

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

Signed-off-by: Brian Maly <[email protected]>
Signed-off-by: Ethan Zhao <[email protected]>
---
drivers/cpufreq/Kconfig.x86 | 2 +-
drivers/cpufreq/intel_pstate.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/Kconfig.x86 b/drivers/cpufreq/Kconfig.x86
index 89ae88f..94c9e6b 100644
--- a/drivers/cpufreq/Kconfig.x86
+++ b/drivers/cpufreq/Kconfig.x86
@@ -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.
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 5498eb0..7c5faea 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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");
--
1.8.3.1

2014-11-18 08:29:18

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Ethan Zhao <[email protected]>
---
drivers/cpufreq/intel_pstate.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 27bb6d3..5498eb0 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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)
--
1.8.3.1

2014-11-18 08:29:17

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] intel_pstate: add module and kernel command line parameter to ignore ACPI _PPC

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.

Signed-off-by: Ethan Zhao <[email protected]>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/cpufreq/intel_pstate.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4c81a86..f502b85 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -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)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 7c5faea..388387b 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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");
--
1.8.3.1

2014-11-18 08:28:46

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] intel_pstate: add module and kernel command line parameter to ignore ACPI _PPC

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.

Signed-off-by: Ethan Zhao <[email protected]>
---
Documentation/kernel-parameters.txt | 3 +++
drivers/cpufreq/intel_pstate.c | 8 +++++++-
2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 4c81a86..f502b85 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -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)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 7c5faea..388387b 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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");
--
1.8.3.1

2014-11-18 08:30:26

by Ethan Zhao

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Ethan Zhao <[email protected]>
---
drivers/cpufreq/intel_pstate.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 27bb6d3..5498eb0 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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)
--
1.8.3.1

2014-11-18 08:32:33

by Ethan Zhao

[permalink] [raw]
Subject: Re: [PATCH] intel_pstate: allow to be built as module and handle Sun server power capping.

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

Thanks,
Ethan

On 2014/11/18 16:27, Ethan Zhao wrote:
> 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(-)
>