SHA256
1
0
forked from pool/powertop
powertop/powertop_cstate_fix.patch
Thomas Renninger baf3fdf131 Accepting request 547222 from home:trenn:branches:Base:System
- Upgrade to version 2.9
Already mainline:
D powertop-2.8-potential-segfaults.patch
D powertop-no-date.patch
From mainline (after 2.9):
A powertop_cstate_fix.patch
A powertop_libc++_fix.patch

OBS-URL: https://build.opensuse.org/request/show/547222
OBS-URL: https://build.opensuse.org/package/show/Base:System/powertop?expand=0&rev=52
2017-12-01 16:47:17 +00:00

39 lines
1.5 KiB
Diff

commit f3f350f138912dc89abb37676f7e65fc6057ec53
Author: Gautam Paranjape <gautam.paranjape@intel.com>
Date: Fri Jul 21 07:02:13 2017 -0700
Some c-states exposed by the intel_idle driver are assigned
the same line_level, which means that the most recent one
assigned can overwrite another c-state. For example, the
C1-SKL c-state is overwritten by the C1E-SKL c-state because
both have a "1" in the name and are assigned the same line
level. To fix this, check if a "sub c-state" (ex. C1E-SKL)
is being inserted. If so, check the vector of c-states if
a c-state with similar name (ex. C1-SKL) exists, and
increment the line level.
Signed-off-by: Gautam Paranjape <gautam.paranjape@intel.com>
diff --git a/src/cpu/abstract_cpu.cpp b/src/cpu/abstract_cpu.cpp
index bc32336..c59721c 100644
--- a/src/cpu/abstract_cpu.cpp
+++ b/src/cpu/abstract_cpu.cpp
@@ -218,6 +218,17 @@ void abstract_cpu::insert_cstate(const char *linux_name, const char *human_name,
}
if (*c >= '0' && *c <='9') {
state->line_level = strtoull(c, NULL, 10);
+ if(*(c+1) != '-'){
+ int greater_line_level = strtoull(c, NULL, 10);
+ for(unsigned int pos = 0; pos < cstates.size(); pos++){
+ if(*c == cstates[pos]->human_name[1]){
+ if(*(c+1) != cstates[pos]->human_name[2]){
+ greater_line_level = max(greater_line_level, cstates[pos]->line_level);
+ state->line_level = greater_line_level + 1;
+ }
+ }
+ }
+ }
break;
}
c++;