From 3104141ff670ca2ff1d4cefb5705ce034137f098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Sun, 13 May 2018 21:03:36 +0200 Subject: [PATCH] cpu: Fix verification of EPB on Linux 4.13+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tuned/plugins/plugin_cpu.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index 6a5ea36..30c5d63 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -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