From 2f055d9fc55b0ab5ff9996d99bce4d7e331db879 Mon Sep 17 00:00:00 2001 From: Aleix Roca Nonell Date: Thu, 11 May 2023 17:25:48 +0200 Subject: [PATCH] Set intel_pstate=passive and disable frequency boost --- xeon08/configuration.nix | 1 + xeon08/cpufreq.nix | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 xeon08/cpufreq.nix diff --git a/xeon08/configuration.nix b/xeon08/configuration.nix index 519c954..7899173 100644 --- a/xeon08/configuration.nix +++ b/xeon08/configuration.nix @@ -6,6 +6,7 @@ #(modulesPath + "/installer/netboot/netboot-minimal.nix") ./kernel/kernel.nix + ./cpufreq.nix ./fs.nix ./users.nix ./slurm.nix diff --git a/xeon08/cpufreq.nix b/xeon08/cpufreq.nix new file mode 100644 index 0000000..29498c4 --- /dev/null +++ b/xeon08/cpufreq.nix @@ -0,0 +1,40 @@ +{ lib, ... }: + +{ + # Disable frequency boost by default. Use the intel_pstate driver instead of + # acpi_cpufreq driver because the acpi_cpufreq driver does not read the + # complete range of P-States [1]. Use the intel_pstate passive mode [2] to + # disable HWP, which allows a core to "select P-states by itself". Also, this + # disables intel governors, which confusingly, have the same names as the + # generic ones but behave differently [3]. + + # Essentially, we use the generic governors, but use the intel driver to read + # the P-state list. + + # [1] - https://www.kernel.org/doc/html/latest/admin-guide/pm/intel_pstate.html#intel-pstate-vs-acpi-cpufreq + # [2] - https://www.kernel.org/doc/html/latest/admin-guide/pm/intel_pstate.html#passive-mode + # [3] - https://www.kernel.org/doc/html/latest/admin-guide/pm/intel_pstate.html#active-mode + # https://www.kernel.org/doc/html/latest/admin-guide/pm/cpufreq.html + + # set intel_pstate to passive mode + boot.kernelParams = [ + "intel_pstate=passive" + ]; + # Disable frequency boost + system.activationScripts = { + disableFrequencyBoost.text = '' + echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo + ''; + }; + + ## disable intel_pstate + #boot.kernelParams = [ + # "intel_pstate=disable" + #]; + ## Disable frequency boost + #system.activationScripts = { + # disableFrequencyBoost.text = '' + # echo 0 > /sys/devices/system/cpu/cpufreq/boost + # ''; + #}; +}