1
0
Fork 0

cpu: Fix verification of EPB on Linux 4.13+

Fix verification of Energy Performance Bias on Linux 4.13+.
In Linux 4.13, the value strings accepted by the x86_energy_perf_policy
program changed.

Resolves: rhbz#1508468

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2018-05-13 21:03:36 +02:00
parent c2eb0858d1
commit 3104141ff6

View file

@ -282,9 +282,19 @@ class CPULatencyPlugin(base.Plugin):
v = s
return v
# Before Linux 4.13
def _energy_perf_policy_to_human(self, s):
return {0:"performance", 6:"normal", 15:"powersave"}.get(self._try_parse_num(s), s)
# Since Linux 4.13
def _energy_perf_policy_to_human_v2(self, s):
return {0:"performance",
4:"balance-performance",
6:"normal",
8:"balance-power",
15:"power",
}.get(self._try_parse_num(s), s)
@command_get("energy_perf_bias")
def _get_energy_perf_bias(self, device, ignore_missing=False):
energy_perf_bias = None
@ -300,5 +310,8 @@ class CPULatencyPlugin(base.Plugin):
if len(l) == 2:
energy_perf_bias = self._energy_perf_policy_to_human(l[1])
break
elif len(l) == 3:
energy_perf_bias = self._energy_perf_policy_to_human_v2(l[2])
break
return energy_perf_bias