File moved-kernel-paths-1.patch of Package tuned
Patch for PED-7308. Keeps existing tuned configuration working (opposite to
upstream).
--- a/tuned/plugins/plugin_sysctl.py 2019-01-08 15:07:03.000000000 +0100
+++ b/tuned/plugins/plugin_sysctl.py 2023-12-04 08:48:42.041259222 +0100
@@ -74,6 +74,10 @@
return self._cmd.execute(execute)
def _read_sysctl(self, option):
+ if option.startswith("kernel.sched_"):
+ return self._read_sched_special(option)
+ if option.startswith("kernel.numa_balancing_"):
+ return self._read_numa_special(option)
retcode, stdout = self._execute_sysctl(["-e", option])
if retcode == 0:
parts = [self._cmd.remove_ws(value) for value in stdout.split("=", 1)]
@@ -83,5 +87,43 @@
return None
def _write_sysctl(self, option, value):
+ if option.startswith("kernel.sched_"):
+ return self._write_sched_special(option, value)
+ if option.startswith("kernel.numa_balancing_"):
+ return self._write_numa_special(option, value)
retcode, stdout = self._execute_sysctl(["-q", "-w", "%s=%s" % (option, value)])
return retcode == 0
+
+ def _read_sched_special(self, option):
+ path = option[13:]
+ data = self._cmd.read_file("/sys/kernel/debug/sched/" + path, err_ret = None)
+ if data is None:
+ log.error("Error reading '%s'" % path)
+ log.error("This may not work with Secure Boot or kernel_lockdown")
+ return data
+
+ def _write_sched_special(self, option, value):
+ if value is None:
+ return None
+ path = option[13:]
+ if not self._cmd.write_to_file("/sys/kernel/debug/sched/" + path, value):
+ log.error("Error writing value '%s' to '%s'" % (value, path))
+ log.error("This may not work with Secure Boot or kernel_lockdown")
+ return value
+
+ def _read_numa_special(self, option):
+ path = option[22:]
+ data = self._cmd.read_file("/sys/kernel/debug/sched/numa_balancing/" + path, err_ret = None)
+ if data is None:
+ log.error("Error reading '%s'" % path)
+ log.error("This may not work with Secure Boot or kernel_lockdown")
+ return data
+
+ def _write_numa_special(self, option, value):
+ if value is None:
+ return None
+ path = option[22:]
+ if not self._cmd.write_to_file("/sys/kernel/debug/sched/numa_balancing/" + path, value):
+ log.error("Error writing value '%s' to '%s'" % (value, path))
+ log.error("This may not work with Secure Boot or kernel_lockdown")
+ return value