printk: allow disabling printk per-console device kthreads at boot

This commit is contained in:
Andrew Lukoshko 2024-04-18 12:17:14 +00:00
parent 6bcbe27d66
commit d822c9eb58
2 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,77 @@
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

View File

@ -960,6 +960,7 @@ Patch1: patch-%{patchversion}-redhat.patch
# AlmaLinux patches
Patch1001: 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch
Patch1002: 0001-printk-allow-disabling-printk-per-console-device-kth.patch
# Bring back deprecated PCI ids #CFHack #CFHack2024
Patch2001: 0001-Enable-all-disabled-pci-devices-by-moving-to-unmaint.patch
@ -1715,6 +1716,7 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch
%endif
ApplyPatch 0001-nvme-pci-add-BOGUS_NID-for-Intel-0a54-device.patch
ApplyPatch 0001-printk-allow-disabling-printk-per-console-device-kth.patch
ApplyOptionalPatch linux-kernel-test.patch
@ -3780,6 +3782,7 @@ fi
- be2iscsi: bring back deprecated PCI ids
- nvme-pci: add BOGUS_NID for Intel 0a54 device
- kernel/rh_messages.h: empty rh_disabled_pci_devices and rh_unmaintained_pci_devices lists
- printk: allow disabling printk per-console device kthreads at boot
* Thu Feb 22 2024 Scott Weaver <scweaver@redhat.com> [5.14.0-427.el9]
- scsi: smartpqi: Fix disable_managed_interrupts (Tomas Henzl) [RHEL-26145]