diff --git a/assets/performanceprofile/tuned/openshift-node-performance b/assets/performanceprofile/tuned/openshift-node-performance index 7569013f06..18becd08fc 100644 --- a/assets/performanceprofile/tuned/openshift-node-performance +++ b/assets/performanceprofile/tuned/openshift-node-performance @@ -165,7 +165,7 @@ cmdline_pstate=+intel_pstate=passive {{else if .HardwareTuning}} cmdline_pstate=+intel_pstate=active {{else if .RealTimeHint}} -cmdline_pstate=+intel_pstate=disable +cmdline_pstate=+intel_pstate=${f:intel_recommended_pstate} {{end}} [rtentsk] diff --git a/assets/tuned/daemon/tuned/profiles/functions/function_set_pstate.py b/assets/tuned/daemon/tuned/profiles/functions/function_set_pstate.py new file mode 100644 index 0000000000..c778503007 --- /dev/null +++ b/assets/tuned/daemon/tuned/profiles/functions/function_set_pstate.py @@ -0,0 +1,37 @@ +import os +import tuned.logs +from . import base +from tuned.utils.commands import commands + +log = tuned.logs.get() + +processor_name = ("sandybridge", + "ivybridge", + "haswell", + "broadwell", + "skylake", + "kabylake", + "cometlake", + "canonlake") + +pmu_path = "/sys/devices/cpu/caps/pmu_name" +class intel_recommended_pstate(base.Function): + """ + Checks the processor name and set the pstate + """ + def __init__(self): + # arbitrary number of arguments + super(intel_recommended_pstate, self).__init__("set_pstate_processor", 0) + + def execute(self, args): + pstate="disable" + if not super(intel_recommended_pstate, self).execute(args): + return None + + current_processor_name = self._cmd.read_file(pmu_path) + if current_processor_name == "" or current_processor_name in processor_name: + return pstate + pstate = "active" + return pstate + +