Accepting request 668599 from home:trenn:branches:Base:System

- Differ archs and x86 CPU vendors to avoid wrong warning about a
  missing intel tool (x86_energy_perf_bias)
- Remember arch and x86 CPU vendor to allow arch/vendor specific
  CPU tunings in the future (fate#326694)

OBS-URL: https://build.opensuse.org/request/show/668599
OBS-URL: https://build.opensuse.org/package/show/Base:System/tuned?expand=0&rev=59
This commit is contained in:
Thomas Renninger 2019-01-25 11:20:50 +00:00 committed by Git OBS Bridge
parent a69c857421
commit a4956fdd5b
3 changed files with 81 additions and 0 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Jan 16 10:47:12 UTC 2019 - trenn@suse.de
- Differ archs and x86 CPU vendors to avoid wrong warning about a
missing intel tool (x86_energy_perf_bias)
- Remember arch and x86 CPU vendor to allow arch/vendor specific
CPU tunings in the future (fate#326694)
-------------------------------------------------------------------
Fri Jan 11 18:26:17 UTC 2019 - trenn@suse.de

View File

@ -30,6 +30,7 @@ Source1: tuned.rpmlintrc
# PATCH-FIX-OPENSUSE fix-allow-receive_sender-default.patch <allow receive_sender="com.redhat.com"/> allow receive_* is normally
# not needed as that is the default --<p.drouand@gmail.com>
Patch0: fix-allow-receive_sender-default.patch
Patch1: tuned_differ_x86_and_other_archs_in_cpu_plugin.patch
BuildRequires: bash-completion
BuildRequires: desktop-file-utils
BuildRequires: pkgconfig

View File

@ -0,0 +1,72 @@
diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py
index 8f0babd..241e157 100644
--- a/tuned/plugins/plugin_cpu.py
+++ b/tuned/plugins/plugin_cpu.py
@@ -7,6 +7,8 @@ import tuned.consts as consts
import os
import struct
import errno
+import platform
+import procfs
log = tuned.logs.get()
@@ -22,7 +24,11 @@ class CPULatencyPlugin(base.Plugin):
super(CPULatencyPlugin, self).__init__(*args, **kwargs)
self._has_pm_qos = True
- self._has_energy_perf_bias = True
+ self._arch = "x86_64"
+ self._is_x86 = False
+ self._is_intel = False
+ self._is_amd = False
+ self._has_energy_perf_bias = False
self._has_intel_pstate = False
self._min_perf_pct_save = None
@@ -58,6 +64,33 @@ class CPULatencyPlugin(base.Plugin):
"no_turbo" : None,
}
+ def _check_arch(self):
+ intel_archs = [ "x86_64", "i686", "i585", "i486", "i386" ]
+ self._arch = platform.machine()
+
+ if self._arch in intel_archs:
+ # Possible other x86 vendors (from arch/x86/kernel/cpu/*):
+ # "CentaurHauls", "CyrixInstead", "Geode by NSC", "HygonGenuine", "GenuineTMx86",
+ # "TransmetaCPU", "UMC UMC UMC"
+ cpu = procfs.cpuinfo()
+ vendor = cpu.tags.get("vendor_id")
+ if vendor is "GenuineIntel":
+ self._is_intel = True
+ elif vendor is "AuthenticAMD" or vendor is "HygonGenuine":
+ self._is_amd = True
+ else:
+ # We always assign Intel, unless we know better
+ self._is_intel = True
+ log.info("We are running on an x86 %s platform" % vendor)
+ else:
+ log.info("We are running on %s (non x86)" % self._arch)
+
+ if self._is_intel is True:
+ # Check for x86_energy_perf_policy, ignore if not available / supported
+ self._check_energy_perf_bias()
+ # Check for intel_pstate
+ self._check_intel_pstate()
+
def _check_energy_perf_bias(self):
self._has_energy_perf_bias = False
retcode_unsupported = 1
@@ -110,10 +143,7 @@ class CPULatencyPlugin(base.Plugin):
else:
instance._load_monitor = None
- # Check for x86_energy_perf_policy, ignore if not available / supported
- self._check_energy_perf_bias()
- # Check for intel_pstate
- self._check_intel_pstate()
+ self._check_arch()
else:
instance._first_instance = False
log.info("Latency settings from non-first CPU plugin instance '%s' will be ignored." % instance.name)