linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org,
	x86@kernel.org, arnd@arndb.de,
	srinivas.pandruvada@linux.intel.com, bberg@redhat.com,
	bp@suse.de
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH 2/3] x86/mce/therm_throt: allow disabling verbose logging
Date: Tue,  7 Apr 2020 00:33:44 -0600	[thread overview]
Message-ID: <20200407063345.4484-2-Jason@zx2c4.com> (raw)
In-Reply-To: <20200407063345.4484-1-Jason@zx2c4.com>

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 <Jason@zx2c4.com>
---
 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


  reply	other threads:[~2020-04-07  6:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07  6:33 [PATCH 1/3] x86/mce/therm_throt: remove unused platform_thermal_notify function pointer Jason A. Donenfeld
2020-04-07  6:33 ` Jason A. Donenfeld [this message]
2020-04-07  6:33 ` [PATCH 3/3] x86/mce/therm_throt: allow disabling the thermal vector altogether Jason A. Donenfeld
2020-04-14  3:38   ` Srinivas Pandruvada
2020-04-14  4:21     ` Jason A. Donenfeld
2020-04-14 14:45       ` Srinivas Pandruvada
2020-04-14 19:41         ` Jason A. Donenfeld
2020-04-14 19:58           ` Srinivas Pandruvada
2020-04-14 20:09             ` Jason A. Donenfeld
2020-04-14 20:23           ` Borislav Petkov
2020-04-14 20:49             ` Srinivas Pandruvada
2020-04-14 21:07               ` Jason A. Donenfeld
2020-04-14 21:51                 ` Srinivas Pandruvada
2020-04-14 21:40   ` Peter Zijlstra
2020-04-14 21:44     ` Srinivas Pandruvada
2020-04-13 21:09 ` [PATCH 1/3] x86/mce/therm_throt: remove unused platform_thermal_notify function pointer Jason A. Donenfeld
2020-04-14  3:55 ` Srinivas Pandruvada
2020-04-14  4:21   ` Jason A. Donenfeld
2020-04-14 14:49     ` Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200407063345.4484-2-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=arnd@arndb.de \
    --cc=bberg@redhat.com \
    --cc=bp@suse.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).