diff mbox series

x86: Do not override performance EPB MSR value on servers

Message ID 36183132.7cOCK0nhyl@house (mailing list archive)
State Changes Requested, archived
Headers show
Series x86: Do not override performance EPB MSR value on servers | expand

Commit Message

Thomas Renninger April 8, 2019, 8:46 a.m. UTC
It is about this kernel message showing up on quite a lot servers:
[    0.072652] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
[    0.076003] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)

With this patch the EPB value is not overridden anymore on systems
which expose themselves as appliance or enterprise server via ACPI
perferred profile variable.

Signed-off-by: trenn@suse.de

Comments

Thomas Renninger April 8, 2019, 8:51 a.m. UTC | #1
On Monday, April 8, 2019 10:46:46 AM CEST Thomas Renninger wrote:
> It is about this kernel message showing up on quite a lot servers:
> [    0.072652] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
> [    0.076003] ENERGY_PERF_BIAS: View and update with
> x86_energy_perf_policy(8)
> 
> With this patch the EPB value is not overridden anymore on systems
> which expose themselves as appliance or enterprise server via ACPI
> perferred profile variable.
> 
> Signed-off-by: trenn@suse.de

The patch has successfully been tested on top of Rafeals latest EPB
fixes:
[PATCH 0/2] PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS handling fixes and sysfs 
i/f

EPB value is now successfully and correctly restored after CPU off-/onlining
It can be set back to performance value if kernel set it to normal and this
value also survives CPU off-/onlining.

Still the kernel should not override the performance value on servers, so
it would be nice to see the patch applied.
Once applied, I may send a patch based on code before EPB changes similar to 
this for stable kernels. There it is even more urgent, due to the wrong
unconditional setting to "normal" value after CPU off-/onlining.

I tested the patch to make sure the preferred value is considered and it
works.

        Thomas
Rafael J. Wysocki April 16, 2019, 9:31 p.m. UTC | #2
On Mon, Apr 8, 2019 at 10:46 AM Thomas Renninger <trenn@suse.de> wrote:
>
> It is about this kernel message showing up on quite a lot servers:
> [    0.072652] ENERGY_PERF_BIAS: Set to 'normal', was 'performance'
> [    0.076003] ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)
>
> With this patch the EPB value is not overridden anymore on systems
> which expose themselves as appliance or enterprise server via ACPI
> perferred profile variable.
>
> Signed-off-by: trenn@suse.de
>
>
> Index: perf_bias_acpi_server_only/arch/x86/kernel/cpu/intel_epb.c
> ===================================================================
> --- perf_bias_acpi_server_only.orig/arch/x86/kernel/cpu/intel_epb.c     2019-04-05 14:43:04.280222577 +0200
> +++ perf_bias_acpi_server_only/arch/x86/kernel/cpu/intel_epb.c  2019-04-08 10:01:26.029278425 +0200
> @@ -19,6 +19,8 @@
>  #include <asm/cpufeature.h>
>  #include <asm/msr.h>
>
> +#include <linux/acpi.h>
> +
>  /**
>   * DOC: overview
>   *
> @@ -89,7 +91,10 @@ static void intel_epb_restore(void)
>                  * ('normal').
>                  */
>                 val = epb & EPB_MASK;
> -               if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
> +               if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER ||
> +                   acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER) {
> +                       /* Keep performance setting on servers */
> +               } else  if (val == ENERGY_PERF_BIAS_PERFORMANCE) {

I would write this as

if (val == ENERGY_PERF_BIAS_PERFORMANCE &&
    acpi_gbl_FADT.preferred_profile != PM_ENTERPRISE_SERVER &&
    acpi_gbl_FADT.preferred_profile != PM_PERFORMANCE_SERVER) {

but overall the approach is not particularly objectionable.

>                         val = ENERGY_PERF_BIAS_NORMAL;
>                         pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
>                 }
>
diff mbox series

Patch

Index: perf_bias_acpi_server_only/arch/x86/kernel/cpu/intel_epb.c
===================================================================
--- perf_bias_acpi_server_only.orig/arch/x86/kernel/cpu/intel_epb.c	2019-04-05 14:43:04.280222577 +0200
+++ perf_bias_acpi_server_only/arch/x86/kernel/cpu/intel_epb.c	2019-04-08 10:01:26.029278425 +0200
@@ -19,6 +19,8 @@ 
 #include <asm/cpufeature.h>
 #include <asm/msr.h>
 
+#include <linux/acpi.h>
+
 /**
  * DOC: overview
  *
@@ -89,7 +91,10 @@  static void intel_epb_restore(void)
 		 * ('normal').
 		 */
 		val = epb & EPB_MASK;
-		if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
+		if (acpi_gbl_FADT.preferred_profile == PM_ENTERPRISE_SERVER ||
+		    acpi_gbl_FADT.preferred_profile == PM_PERFORMANCE_SERVER) {
+			/* Keep performance setting on servers */
+		} else	if (val == ENERGY_PERF_BIAS_PERFORMANCE) {
 			val = ENERGY_PERF_BIAS_NORMAL;
 			pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n");
 		}