!4 cpu Update checking if EPB is supported

From: @xinghe_1
Reviewed-by: @SuperSix173
Signed-off-by: @SuperSix173
This commit is contained in:
openeuler-ci-bot 2020-09-22 11:30:00 +08:00 committed by Gitee
commit 3b0e94457f
2 changed files with 51 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 43375e6bbe389606fbd24d0a84535285a1a8040c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
Date: Thu, 17 Sep 2020 18:57:24 +0800
Subject: [PATCH] cpu: Update checking if EPB is supported
Update checking if EPB is supported so that it works with recent
versions of the x86_energy_perf_policy tool. Newer versions of
x86_energy_perf_policy, unlike older versions, exit with a zero exit
code even if the CPU doesn't support EPB. Newer versions of the tool
give no ouput on stdout if EPB is not supported, so check for that.
In the future, we might like to determine if EPB is supported by
searching /proc/cpuinfo for specific CPU flags. However the solution
described in the previous paragraph should work just fine for now.
Resolves: rhbz#1690929
Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
https://github.com/redhat-performance/tuned/pull/217/commits/43375e6bbe389606fbd24d0a84535285a1a8040c
---
tuned/plugins/plugin_cpu.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py
index 8f0babd..4934022 100644
--- a/tuned/plugins/plugin_cpu.py
+++ b/tuned/plugins/plugin_cpu.py
@@ -61,8 +61,11 @@ class CPULatencyPlugin(base.Plugin):
def _check_energy_perf_bias(self):
self._has_energy_perf_bias = False
retcode_unsupported = 1
- retcode = self._cmd.execute(["x86_energy_perf_policy", "-r"], no_errors = [errno.ENOENT, retcode_unsupported])[0]
- if retcode == 0:
+ retcode, out = self._cmd.execute(["x86_energy_perf_policy", "-r"], no_errors = [errno.ENOENT, retcode_unsupported])
+ # With recent versions of the tool, a zero exit code is
+ # returned even if EPB is not supported. The output is empty
+ # in that case, however.
+ if retcode == 0 and out != "":
self._has_energy_perf_bias = True
elif retcode < 0:
log.warning("unable to run x86_energy_perf_policy tool, ignoring CPU energy performance bias, is the tool installed?")
--
2.23.0

View File

@ -1,7 +1,7 @@
Summary: A system tuning service for Linux Summary: A system tuning service for Linux
Name: tuned Name: tuned
Version: 2.10.0 Version: 2.10.0
Release: 7 Release: 8
License: GPLv2+ License: GPLv2+
Source0: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel2}.tar.gz Source0: https://github.com/redhat-performance/%{name}/archive/v%{version}%{?prerel2}.tar.gz#/%{name}-%{version}%{?prerel2}.tar.gz
URL: http://www.tuned-project.org/ URL: http://www.tuned-project.org/
@ -31,6 +31,8 @@ Patch0: tuned-2.10.0-python-3.7-fix.patch
Patch1: 0001-tuned-adm-Fix-a-traceback-when-run-without-action-sp.patch Patch1: 0001-tuned-adm-Fix-a-traceback-when-run-without-action-sp.patch
Patch2: tuned-2.10.0-makefile-full-python-path.patch Patch2: tuned-2.10.0-makefile-full-python-path.patch
Patch3: 0001-tuned-gui-Sort-plugins-based-on-their-name.patch Patch3: 0001-tuned-gui-Sort-plugins-based-on-their-name.patch
Patch4: fix-cpu-Update-checking-if-EPB-is-supported.patch
Patch9000: bugfix-tuned-2.8.0-restart-after-kill-dbus.patch Patch9000: bugfix-tuned-2.8.0-restart-after-kill-dbus.patch
Patch9001: 0005-realtime-virtual-host-pin-only-the-vcpu-thread-to-is.patch Patch9001: 0005-realtime-virtual-host-pin-only-the-vcpu-thread-to-is.patch
@ -300,6 +302,9 @@ fi
%{_mandir}/man7/%{name}-profiles-nfv-host.7* %{_mandir}/man7/%{name}-profiles-nfv-host.7*
%changelog %changelog
* Fri Sep 18 2020 xinghe <xinghe1@huawei.com> - 2.10.0-8
- cpu Update checking if EPB is supported
* Sun Sep 7 2019 hejingxian<hejingxian@huawei.com> - 2.10.0-7 * Sun Sep 7 2019 hejingxian<hejingxian@huawei.com> - 2.10.0-7
- Type:other - Type:other
- ID:NA - ID:NA