2020-04-07 06:34:39

by Jason A. Donenfeld

[permalink] [raw]
Subject: [PATCH 2/3] x86/mce/therm_throt: allow disabling verbose logging

There is an enormous amount of fiddly book keeping and an auxiliary
workqueue just for the purpose of ratelimiting and reliably printing
messages regarding thermal events and throttling, which uses CPU in a
rather common interrupt. Add an option to disable this verbose
reporting.

Signed-off-by: Jason A. Donenfeld <[email protected]>
---
arch/x86/Kconfig | 9 +++++++++
arch/x86/kernel/cpu/mce/therm_throt.c | 3 +++
2 files changed, 12 insertions(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index beea77046f9b..39e7444353af 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1159,6 +1159,15 @@ config X86_THERMAL_VECTOR
def_bool y
depends on X86_MCE_INTEL

+config X86_MCE_THERMAL_VERBOSE
+ bool "Verbose logging for thermal events"
+ depends on X86_THERMAL_VECTOR
+ ---help---
+ Display messages in the kernel log when thermal events are triggered,
+ such as overheating and throttling. This mostly only uses extra CPU
+ for ratelimiting and book keeping, so unless you need these logs, it
+ is safe to say N.
+
source "arch/x86/events/Kconfig"

config X86_LEGACY_VM86
diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c b/arch/x86/kernel/cpu/mce/therm_throt.c
index f904e85eb68f..6d726190a40a 100644
--- a/arch/x86/kernel/cpu/mce/therm_throt.c
+++ b/arch/x86/kernel/cpu/mce/therm_throt.c
@@ -313,6 +313,9 @@ static void therm_throt_process(bool new_event, int event, int level)
u64 now;
struct thermal_state *pstate = &per_cpu(thermal_state, this_cpu);

+ if (!IS_ENABLED(CONFIG_X86_MCE_THERMAL_VERBOSE))
+ return;
+
now = get_jiffies_64();
if (level == CORE_LEVEL) {
if (event == THERMAL_THROTTLING_EVENT)
--
2.26.0