kernel/SOURCES/0001-printk-allow-disabling-printk-per-console-device-kth.patch

78 lines
2.6 KiB
Diff

From 2767891ad81d4a0077f8f2123b7ce3b03b55289e Mon Sep 17 00:00:00 2001
From: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>
Date: Wed, 13 Mar 2024 10:07:11 -0300
Subject: [PATCH] printk: allow disabling printk per-console device kthreads at
boot
JIRA: https://issues.redhat.com/browse/RHEL-17709
Upstream Status: RHEL only
Create the 'printk_no_perconsole_kthreads' boot parameter, allowing one to disable the
per-console device printk kthreads, which are enabled by default.
Signed-off-by: Luis Claudio R. Goncalves <lgoncalv@redhat.com>
---
.../admin-guide/kernel-parameters.txt | 4 +++
kernel/printk/printk.c | 26 +++++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index fca105370555..8a6d9d23bb65 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4526,6 +4526,10 @@
printk.time= Show timing data prefixed to each printk message line
Format: <bool> (1/Y/y=enable, 0/N/n=disable)
+ printk_no_perconsole_kthreads
+ [KNL] Disable the printk per-console device kthreads.
+ This option is not available for RT kernels.
+
processor.max_cstate= [HW,ACPI]
Limit processor to maximum C-state
max_cstate=9 overrides any DMI blacklist limit.
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f1f9ce9b23f6..aeb9b85dcb06 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3853,10 +3853,36 @@ static int __init printk_late_init(void)
}
late_initcall(printk_late_init);
+/*
+ * This boot parameter allows one to disable the per-console device printk
+ * kernel threads, which are enabled by default.
+ */
+static bool __read_mostly printk_no_perconsole_kthreads = false;
+
+static int __init disable_printk_pdkth_setup(char *str)
+{
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
+ printk_no_perconsole_kthreads = true;
+ pr_info("Disabling printk per-console device kthreads.\n");
+ } else {
+ pr_info("Can't disable printk per-console device kthreads on RT.\n");
+ }
+
+ return 0;
+}
+
+early_param("printk_no_perconsole_kthreads", disable_printk_pdkth_setup);
+module_param(printk_no_perconsole_kthreads, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(printk_no_perconsole_kthreads,
+ "Disable printk per-console device kthreads.");
+
static int __init printk_activate_kthreads(void)
{
struct console *con;
+ if (unlikely(printk_no_perconsole_kthreads))
+ return 0;
+
console_lock();
printk_kthreads_available = true;
for_each_console(con)
--
2.27.0