[PATCH 3/3] x86/mce/therm_throt: allow disabling the thermal vector altogether

From: Jason A. Donenfeld
Date: Tue Apr 07 2020 - 02:34:03 EST


The thermal IRQ handler uses 1.21% CPU on my system when it's hot from
compiling things. Indeed looking at /proc/interrupts reveals quite a lot
of events coming in. Beyond logging them, the existing drivers on the
system don't appear to do very much that I'm interested in. So, add a
way to disable this entirely so that I can regain precious CPU cycles.

Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
---
arch/x86/Kconfig | 4 ++++
arch/x86/kernel/cpu/mce/intel.c | 3 ++-
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 39e7444353af..3125a11932f2 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1157,7 +1157,11 @@ config X86_MCE_INJECT

config X86_THERMAL_VECTOR
def_bool y
+ prompt "Machine check thermal vector"
depends on X86_MCE_INTEL
+ ---help---
+ Provide support for capturing thermal events, logging them, and
+ passing them off to other drivers.

config X86_MCE_THERMAL_VERBOSE
bool "Verbose logging for thermal events"
diff --git a/arch/x86/kernel/cpu/mce/intel.c b/arch/x86/kernel/cpu/mce/intel.c
index f996ffb887bc..d14f1922fb49 100644
--- a/arch/x86/kernel/cpu/mce/intel.c
+++ b/arch/x86/kernel/cpu/mce/intel.c
@@ -511,7 +511,8 @@ static void intel_ppin_init(struct cpuinfo_x86 *c)

void mce_intel_feature_init(struct cpuinfo_x86 *c)
{
- intel_init_thermal(c);
+ if (IS_ENABLED(CONFIG_X86_THERMAL_VECTOR))
+ intel_init_thermal(c);
intel_init_cmci();
intel_init_lmce();
intel_ppin_init(c);
--
2.26.0