From 3a1a52f4b9d662e8fd6a3bebf596c5fbe0c237eb Mon Sep 17 00:00:00 2001 From: Misaki Kasumi Date: Mon, 2 Dec 2024 13:28:35 +0800 Subject: [PATCH] plugin_cpu: allow raw energy_performance_preference values --- tuned/plugins/plugin_cpu.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tuned/plugins/plugin_cpu.py b/tuned/plugins/plugin_cpu.py index 50ccef43..eec9fd70 100644 --- a/tuned/plugins/plugin_cpu.py +++ b/tuned/plugins/plugin_cpu.py @@ -798,7 +798,13 @@ def _set_energy_performance_preference(self, energy_performance_preference, devi if not sim: avail_vals = set(self._cmd.read_file(self._pstate_preference_path(cpu_id, True)).split()) for val in vals: - if val in avail_vals: + try: + val = int(val) + valid = 0 <= val < 256 + val = str(val) + except ValueError: + valid = val in avail_vals + if valid: self._cmd.write_to_file(self._pstate_preference_path(cpu_id), val, \ no_error = [errno.ENOENT] if remove else False, ignore_same=True) log.info("Setting energy_performance_preference value '%s' for cpu '%s'" % (val, device))