Updates + changes OBS-URL: https://build.opensuse.org/request/show/254973 OBS-URL: https://build.opensuse.org/package/show/Base:System/tuned?expand=0&rev=23
63 lines
2.2 KiB
Diff
63 lines
2.2 KiB
Diff
Index: tuned-2.3.0/tuned/plugins/plugin_cpu.py
|
|
===================================================================
|
|
--- tuned-2.3.0.orig/tuned/plugins/plugin_cpu.py
|
|
+++ tuned-2.3.0/tuned/plugins/plugin_cpu.py
|
|
@@ -91,7 +91,8 @@
|
|
# Check for cpupower, use workaround if not available
|
|
self._check_cpupower()
|
|
# Check for x86_energy_perf_policy, ignore if not available / supported
|
|
- self._check_energy_perf_bias()
|
|
+ if self._has_cpupower is False:
|
|
+ self._check_energy_perf_bias()
|
|
# Check for intel_pstate
|
|
self._check_intel_pstate()
|
|
else:
|
|
@@ -207,7 +208,17 @@
|
|
|
|
@command_set("energy_perf_bias", per_device=True)
|
|
def _set_energy_perf_bias(self, energy_perf_bias, device):
|
|
- if self._has_energy_perf_bias:
|
|
+ if self._has_cpupower is True:
|
|
+ bias_str = str(energy_perf_bias)
|
|
+ if bias_str == "performance":
|
|
+ bias_str = "0"
|
|
+ elif bias_str == "powersave":
|
|
+ bias_str = "15"
|
|
+ elif bias_str == "normal":
|
|
+ bias_str = "6"
|
|
+ cpu_id = device.lstrip("cpu")
|
|
+ tuned.utils.commands.execute(["cpupower", "-c", cpu_id, "set", "-b", bias_str])
|
|
+ elif self._has_energy_perf_bias:
|
|
log.info("setting energy_perf_bias '%s' on cpu '%s'" % (energy_perf_bias, device))
|
|
cpu_id = device.lstrip("cpu")
|
|
self._cmd.execute(["x86_energy_perf_policy", "-c", cpu_id, str(energy_perf_bias)])
|
|
@@ -215,14 +226,21 @@
|
|
@command_get("energy_perf_bias")
|
|
def _get_energy_perf_bias(self, device):
|
|
energy_perf_bias = None
|
|
- if self._has_energy_perf_bias:
|
|
+ if self._has_cpupower is True:
|
|
+ cpu_id = device.lstrip("cpu")
|
|
+ retcode, lines = tuned.utils.commands.execute(["cpupower", "-c", cpu_id, "info", "-b"])
|
|
+ elif self._has_energy_perf_bias:
|
|
cpu_id = device.lstrip("cpu")
|
|
retcode, lines = self._cmd.execute(["x86_energy_perf_policy", "-c", cpu_id, "-r"])
|
|
- if retcode == 0:
|
|
- for line in lines.splitlines():
|
|
- l = line.split()
|
|
- if len(l) == 2:
|
|
- energy_perf_bias = l[1]
|
|
- break
|
|
+ else:
|
|
+ return None
|
|
+ if retcode == 0:
|
|
+ for line in lines.splitlines():
|
|
+ if line.startswith("analyzing CPU"):
|
|
+ continue
|
|
+ l = line.split()
|
|
+ if len(l) == 2:
|
|
+ energy_perf_bias = l[1]
|
|
+ break
|
|
|
|
return energy_perf_bias
|