lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon,  2 Sep 2019 15:35:07 +0200
From:   Erwan Velu <erwanaliasr1@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Erwan Velu <e.velu@...teo.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Len Brown <lenb@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Luwei Kang <luwei.kang@...el.com>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Chao Peng <chao.p.peng@...ux.intel.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Subject: [PATCH] tools/power/x86/turbostat: Reporting EPB as per Intel's spec

The actual code is reporting the EPB mode by considering a single value,
while Intel's specfication defines ranges.

This patch is about to report the EPB by considering ranges of energy_policy
to actually report the state of the processor.

This avoids reporting a "custom" value while the specification describes
an explicit state of the processor for each value.

0-3  : Maximum performance
4-7  : Balanced Performance
8-11 : Balanced Efficiency
12-15: Powersave

This patch also introduce ENERGY_PERF_BIAS_MIN_POWERSAVE.
The first 3 performance profiles (ENERGY_PERF_BIAS_PERFORMANCE,
ENERGY_PERF_BIAS_BALANCE_PERFORMANCE, ENERGY_PERF_BIAS_BALANCE_POWERSAVE) where defined
by the lowest value of the associate range while ENERGY_PERF_BIAS_POWERSAVE was
defined by the greatest value.

This was a little bit inconsistent and made more difficult to report EPB value per range.

Signed-off-by: Erwan Velu <e.velu@...teo.com>
---
 arch/x86/include/asm/msr-index.h      |  1 +
 tools/power/x86/turbostat/turbostat.c | 23 ++++++++++-------------
 2 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 271d837d69a8..120073dfb195 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -596,6 +596,7 @@
 #define ENERGY_PERF_BIAS_BALANCE_PERFORMANCE	4
 #define ENERGY_PERF_BIAS_NORMAL			6
 #define ENERGY_PERF_BIAS_BALANCE_POWERSAVE	8
+#define ENERGY_PERF_BIAS_MIN_POWERSAVE		12
 #define ENERGY_PERF_BIAS_POWERSAVE		15
 
 #define MSR_IA32_PACKAGE_THERM_STATUS		0x000001b1
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index 75fc4fb9901c..9fa73b468f7e 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -3552,6 +3552,7 @@ dump_sysfs_pstate_config(void)
 int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 {
 	unsigned long long msr;
+	unsigned int perf_bias_value;
 	char *epb_string;
 	int cpu;
 
@@ -3572,20 +3573,16 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p)
 	if (get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr))
 		return 0;
 
-	switch (msr & 0xF) {
-	case ENERGY_PERF_BIAS_PERFORMANCE:
+	 // Reporting perf_bias_performance as per intel specification
+	perf_bias_value = msr & 0xF;
+	epb_string = "powersave";
+	if (perf_bias_value < ENERGY_PERF_BIAS_BALANCE_PERFORMANCE)
 		epb_string = "performance";
-		break;
-	case ENERGY_PERF_BIAS_NORMAL:
-		epb_string = "balanced";
-		break;
-	case ENERGY_PERF_BIAS_POWERSAVE:
-		epb_string = "powersave";
-		break;
-	default:
-		epb_string = "custom";
-		break;
-	}
+	else if (perf_bias_value < ENERGY_PERF_BIAS_BALANCE_POWERSAVE)
+		epb_string = "balanced performance";
+	else if (perf_bias_value < ENERGY_PERF_BIAS_MIN_POWERSAVE)
+		epb_string = "balanced efficiency";
+
 	fprintf(outf, "cpu%d: MSR_IA32_ENERGY_PERF_BIAS: 0x%08llx (%s)\n", cpu, msr, epb_string);
 
 	return 0;
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ