[PATCH] Fix Powertop support for Intel Braswell SOC
by David E. Box
Correct Braswell MSR used to determine PC6 residency.
Signed-off-by: David E. Box <david.e.box(a)linux.intel.com>
---
src/cpu/intel_cpus.cpp | 21 +++++++++++++++++++--
src/cpu/intel_cpus.h | 1 +
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/cpu/intel_cpus.cpp b/src/cpu/intel_cpus.cpp
index 72ecd50..baea8fc 100644
--- a/src/cpu/intel_cpus.cpp
+++ b/src/cpu/intel_cpus.cpp
@@ -289,6 +289,7 @@ nhm_package::nhm_package(int model)
has_c8c9c10_res = 0;
has_c2c6_res = 0;
has_c7_res = 0;
+ has_c6c_res = 0;
switch(model) {
case 0x2A: /* SNB */
@@ -314,6 +315,9 @@ nhm_package::nhm_package(int model)
else
has_c7_res = 0;
}
+ /* BSW only exposes package C6 */
+ else if (model == 0x4C)
+ has_c6c_res=1;
else
has_c3_res = 1;
@@ -360,7 +364,15 @@ void nhm_package::measurement_start(void)
if (this->has_c3_res)
c3_before = get_msr(number, MSR_PKG_C3_RESIDENCY);
- c6_before = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
+ /*
+ * Hack for Braswell where C7 MSR is actually BSW C6
+ */
+ if (this->has_c6c_res)
+ c6_before = get_msr(number, MSR_PKG_C7_RESIDENCY);
+ else
+ c6_before = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
if (this->has_c7_res)
c7_before = get_msr(number, MSR_PKG_C7_RESIDENCY);
if (this->has_c8c9c10_res) {
@@ -401,7 +413,12 @@ void nhm_package::measurement_end(void)
if (this->has_c3_res)
c3_after = get_msr(number, MSR_PKG_C3_RESIDENCY);
- c6_after = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
+ if (this->has_c6c_res)
+ c6_after = get_msr(number, MSR_PKG_C7_RESIDENCY);
+ else
+ c6_after = get_msr(number, MSR_PKG_C6_RESIDENCY);
+
if (this->has_c7_res)
c7_after = get_msr(number, MSR_PKG_C7_RESIDENCY);
if (has_c8c9c10_res) {
diff --git a/src/cpu/intel_cpus.h b/src/cpu/intel_cpus.h
index 810a243..0331069 100644
--- a/src/cpu/intel_cpus.h
+++ b/src/cpu/intel_cpus.h
@@ -77,6 +77,7 @@ public:
int has_c7_res;
int has_c2c6_res;
int has_c3_res;
+ int has_c6c_res; /* BSW */
int has_c8c9c10_res;
nhm_package(int model);
virtual void measurement_start(void);
--
1.9.1
7 years, 1 month
[Announcement] Bugzilla
by Alexandra Yates
We are pleased to announce that PowerTOP now tracks bugs using Bugzilla
app.devzing.com/powertopbugs/bugzilla
Bug #1 logged today is "Incorrect reporting for Intel 3930K model and
others" submitted by Jan Engelhardt. Expect more bugs to be filed in the
next few days.
Please refer to that list to contribute solving PowerTOP issues.
Thank you,
Alexandra.
7 years, 1 month
Incorrect reporting for Intel 3930K model and others
by Jan Engelhardt
Using powertop v2.7-28-g3f5bccb, combined with the following CPU/system:
19:21 niw-hv03:~ # lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 45
Model name: Intel(R) Core(TM) i7-3930K CPU @ 3.20GHz
Stepping: 7
CPU MHz: 3400.000
CPU max MHz: 3800.0000
CPU min MHz: 1200.0000
BogoMIPS: 6400.76
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 12288K
NUMA node0 CPU(s): 0-11
and the following computational non-IO load:
19:23 niw-hv03:~ # w
19:23:42 up 10 days, 18:44, 1 user, load average: 12.73, 12.54, 12.43
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 ares40.inai.de 19:17 6.00s 0.06s 0.00s w
19:23 niw-hv03:~ # sensors
coretemp-isa-0000
Adapter: ISA adapter
Physical id 0: +80.0°C (high = +81.0°C, crit = +91.0°C)
Core 0: +80.0°C (high = +81.0°C, crit = +91.0°C)
Core 1: +79.0°C (high = +81.0°C, crit = +91.0°C)
Core 2: +74.0°C (high = +81.0°C, crit = +91.0°C)
Core 3: +76.0°C (high = +81.0°C, crit = +91.0°C)
Core 4: +78.0°C (high = +81.0°C, crit = +91.0°C)
Core 5: +79.0°C (high = +81.0°C, crit = +91.0°C)
Leads to these frequencies being shown across the system:
19:21 niw-hv03:~ # cpupower frequency-info
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 0.97 ms.
hardware limits: 1.20 GHz - 3.80 GHz
available cpufreq governors: performance, powersave
current policy: frequency should be within 1.20 GHz and 3.80 GHz.
The governor "powersave" may decide which speed to use
within this range.
current CPU frequency is 3.40 GHz (asserted by call to hardware).
boost state support:
Supported: yes
Active: yes
3600 MHz max turbo 4 active cores
3700 MHz max turbo 3 active cores
3800 MHz max turbo 2 active cores
3800 MHz max turbo 1 active cores
# powertop
<Frequency Stats tab>:
Package | Core | CPU 0 CPU 1
| | Actual 3.4 GHz 3.4 GHz
Idle 100.0% | Idle 100.0% | Idle 100.0% 100.0%
| Core | CPU 2 CPU 3
| | Actual 3.4 GHz 3.4 GHz
| Idle 100.0% | Idle 100.0% 100.0%
| Core | CPU 4 CPU 5
| | Actual 3.4 GHz 3.4 GHz
| Idle 100.0% | Idle 100.0% 100.0%
| Core | CPU 6 CPU 7
| | Actual 3.4 GHz 3.4 GHz
| Idle 100.0% | Idle 100.0% 100.0%
| Core | CPU 8 CPU 9
| | Actual 3.4 GHz 3.4 GHz
| Idle 100.0% | Idle 100.0% 100.0%
Why is it showing all-idle-100%? That makes no sense.
Another user reported this to me for a similar model, apparently with a
BIOS-overclocked 4460(non-K) [fam 6 model 60 stepping 3]. BOINC global
host info reveals that 6-60-3 is also used for 4790K.
7 years, 1 month
[PATCH 1/1] Android: Use syscall to write to sysfs nodes
by Daniel Leung
For some reason, ofstream fails to write to sysfs nodes
on Android. So use old-fashion open()/write()/close().
Signed-off-by: Daniel Leung <daniel.leung(a)linux.intel.com>
---
.../0001-Android-disable-C-exceptions.patch | 34 +++++-----------------
src/lib.cpp | 14 +++++++++
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/patches/Android/0001-Android-disable-C-exceptions.patch b/patches/Android/0001-Android-disable-C-exceptions.patch
index 435cd95..b11bdc7 100644
--- a/patches/Android/0001-Android-disable-C-exceptions.patch
+++ b/patches/Android/0001-Android-disable-C-exceptions.patch
@@ -1,4 +1,4 @@
-From 604d8f6da54524f0f7bfdd7aea91d353b4f1b612 Mon Sep 17 00:00:00 2001
+From 4570b7d6559047b384c50b4766e168fd5e11db8e Mon Sep 17 00:00:00 2001
From: Daniel Leung <daniel.leung(a)intel.com>
Date: Wed, 25 Feb 2015 13:24:14 -0800
Subject: [PATCH 1/1] Android: disable C++ exceptions
@@ -11,11 +11,11 @@ Signed-off-by: Daniel Leung <daniel.leung(a)intel.com>
Android.mk | 2 +-
src/devices/ahci.cpp | 8 ++++++++
src/devices/alsa.cpp | 8 ++++++++
- src/lib.cpp | 19 +++++++++++++++++++
- 4 files changed, 36 insertions(+), 1 deletion(-)
+ src/lib.cpp | 15 +++++++++++++++
+ 4 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/Android.mk b/Android.mk
-index dd98d0f..f6b8689 100644
+index 0c95e3a..ff1040a 100644
--- a/Android.mk
+++ b/Android.mk
@@ -14,7 +14,7 @@ LOCAL_MODULE := powertop
@@ -128,28 +128,10 @@ index a1fca71..ba3c0b6 100644
p = (end_active - start_active) / (0.001 + end_active + end_inactive - start_active - start_inactive) * 100.0;
report_utilization(name, p);
diff --git a/src/lib.cpp b/src/lib.cpp
-index 0dec0b7..91dac7a 100644
+index 24d6d07..4812ff1 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
-@@ -176,13 +176,17 @@ void write_sysfs(const string &filename, const string &value)
- file.open(filename.c_str(), ios::out);
- if (!file)
- return;
-+#ifndef DISABLE_TRYCATCH
- try
- {
-+#endif
- file << value;
- file.close();
-+#ifndef DISABLE_TRYCATCH
- } catch (std::exception &exc) {
- return;
- }
-+#endif
- }
-
- int read_sysfs(const string &filename, bool *ok)
-@@ -196,16 +200,23 @@ int read_sysfs(const string &filename, bool *ok)
+@@ -210,16 +210,23 @@ int read_sysfs(const string &filename, bool *ok)
*ok = false;
return 0;
}
@@ -173,7 +155,7 @@ index 0dec0b7..91dac7a 100644
file.close();
return i;
}
-@@ -219,17 +230,21 @@ string read_sysfs_string(const string &filename)
+@@ -233,17 +240,21 @@ string read_sysfs_string(const string &filename)
file.open(filename.c_str(), ios::in);
if (!file)
return "";
@@ -195,7 +177,7 @@ index 0dec0b7..91dac7a 100644
return content;
}
-@@ -246,17 +261,21 @@ string read_sysfs_string(const char *format, const char *param)
+@@ -260,17 +271,21 @@ string read_sysfs_string(const char *format, const char *param)
file.open(filename, ios::in);
if (!file)
return "";
diff --git a/src/lib.cpp b/src/lib.cpp
index 6b1bc0a..24d6d07 100644
--- a/src/lib.cpp
+++ b/src/lib.cpp
@@ -171,6 +171,7 @@ void set_max_cpu(int cpu)
void write_sysfs(const string &filename, const string &value)
{
+#ifndef ANDROID
ofstream file;
file.open(filename.c_str(), ios::out);
@@ -183,6 +184,19 @@ void write_sysfs(const string &filename, const string &value)
} catch (std::exception &exc) {
return;
}
+#else
+ int fd;
+
+ fd = ::open(filename.c_str(), O_WRONLY);
+ if (fd < 0)
+ return;
+
+ ::write(fd, value.c_str(), value.length());
+
+ close(fd);
+
+ return;
+#endif
}
int read_sysfs(const string &filename, bool *ok)
--
1.8.3.2
7 years, 2 months