From: Chris Down <chris@chrisdown.name>
To: Petr Mladek <pmladek@suse.com>
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Tony Lindgren <tony.lindgren@linux.intel.com>,
kernel-team@fb.com
Subject: [PATCH v7 00/13] printk: console: Per-console loglevels
Date: Wed, 19 Nov 2025 03:06:41 +0800 [thread overview]
Message-ID: <cover.1763492585.git.chris@chrisdown.name> (raw)
There was a lot of review feedback last round, I sincerely hope I didn't
miss anything :-)
Thanks, Petr, Greg, John, and Tony for the feedback and reviews.
v7:
- Disallow writing -1 to the global console_loglevel sysctl
- Change printk_get_next_message() to take effective loglevel
- Update suppress_message_printing() to take effective loglevel
- Use CONSOLE_LOGLEVEL_MOTORMOUTH for devkmsg_read()
- Fix documentation per Petr's review comments
- Add console_srcu_read_loglevel() for lockless reading
- Rename per_console_loglevel_is_set() to has_per_console_loglevel()
- Refactor API to take int con_level for better lockdep checking
- Update callers to read con_level using console_srcu_read_loglevel()
- Remove hierarchy comment since it's obvious from the code
- Use LOGLEVEL_DEFAULT as base level instead of hardcoded -1
- Use pr_warn_once() in sysrq handling instead of manual warned variable
- Split sysrq handling into separate commit
- Update code/ABI documentation to change loglevel bounds from 0 to 1
- Remove 'enabled' attribute from sysfs interface
- Move #ifdefs out of sysfs.c
- Fix console_clamp_loglevel() to use documented bounds
- Initialise classdev and level in try_enable_default_console()
- Fix race condition, use console_list_lock() in console_setup_class()
- Remove NULL check before device_unregister()
- Add data_race() annotations to READ_ONCE/WRITE_ONCE for KCSAN
- Remove pr_warn() for unknown loglevel source
- Add error handling for kzalloc() failure
- Make console_class constant via class_register() per Greg
- Export do_proc_dointvec() and do_proc_dointvec_conv()
- Refactor to use @conv callback approach
- Rename printk_console_loglevel() to proc_dointvec_console_loglevel()
- Simplify level assignment to `newcon->level = c->level;` per Petr
- Add missing loglevel= parameter documentation
- Change printk_sysctl_deprecated to proc_dointvec_printk_deprecated
- Add missing kernel parameter documentation for ignore_loglevel
- Reject KERN_EMERG (0) consistently
- Add comprehensive usage examples to per-console-loglevel.rst
- Add troubleshooting section with common issues and solutions
- Update ABI documentation with error conditions and permissions
- Document new struct console fields (level and classdev)
- Rename clamp_loglevel() to console_clamp_loglevel() for clarity
- Add kernel doc comments for internal API functions where it helps
- Initialise classdev in try_enable_default_console() explicitly
- Mark console devices with device_set_pm_not_required()
- Add syslog_lock around SYSLOG_ACTION_CONSOLE_{OFF,ON}
v6:
- Add .rst suffix to documentation in do_syslog
- Add loglevel table to per-console-loglevel.rst and serial-console.rst
- Add newlines between multiline bullets in per-console-loglevel.rst
- Make effective_loglevel doc more clear
- Remove ignore_per_console_loglevel doc, it's not shown in sysfs now
- Use READ_ONCE/WRITE_ONCE for con->level
- Ignore/restore per console loglevel in sysrq
- Add new fields to comment above struct console
- Remove now unused flags field on console_cmdline
- Remove WARN_ON_ONCE(!con) in effective loglevel checks
- Avoid underflow in find_and_remove_console_option if val_buf_size == 0
- Better error message on oversize in find_and_remove_loglevel_option
- Reject if clamped in find_and_remove_loglevel_option
- Clarify level setting logic in __add_preferred_console
- Move console emission check to printk_delay itself
- Use console_src_read_flags in enabled_show
- Infer if extended from con in printk_get_next_message, don't pass args
- Remove misleading comment about early consoles in console_init
- Use a goto in loglevel_store to avoid setting level in multiple places
- Mention only @flags and @level are valid in printk_get_next_message
- Use LOGLEVEL_DEBUG for max clamp in sysctls
- Update for class_create interface changes
- Move sysctl functionality out to sysfs.c
- Purge default_console_loglevel
- Update sysctl docs for kernel.printk deprecation
v5:
- Fix syntax in boot_delay
v4:
- Change base to Linus' master
- Use SRCU iterators for console walks
- Override per-console loglevels on magic sysrq
- Fix htmldocs
- Fix mistaken __user annotation in sysctl callbacks
- Consistently use indexed names (eg. ttyS0 instead of ttyS)
- Remove "The loglevel for a console can be set in many places" comment
- Remove CON_LOGLEVEL flag and infer based on >0
- Open code our dev_get_drvdata console stashing
- Split out console_effective_loglevel functions per Petr's suggestion
- Make boot_delay_msec/printk_delay check if it would be emitted
- Simplify warning on SYSLOG_ACTION_CONSOLE_LEVEL
- Save/restore ignore_per_console_loglevel on syslog console actions
- Unify min/max level checks across sysfs/proc/syslog
- Add find_and_remove_console_option to avoid affecting io/mmio options
v3:
- Update to work with John's kthread patches
- Remove force_console_loglevel, now we only have global and local levels
- Remove minimum_console_loglevel control and document how to change it
- The minimum loglevel is now only honoured on setting global/local level
- Add ignore_per_console_loglevel
- Return -EINVAL if trying to set below minimum console level
- Add parser for named console= options
- Fix docs around ignore_loglevel: it can be changed at runtime
- Fix ordering in "in order of authority" docs
- Remove duplicated default_console_loglevel doc
- Only warn once on syslog() use
v2:
- Dynamically allocate struct device*
- Document sysfs attributes in Documentation/ABI/
- Use sysfs_emit() instead of sprintf() in dev sysfs files
- Remove WARN_ON() for device_add/IS_ERR(console_class)
- Remove "soon" comment for kernel.printk
- Fix !CONFIG_PRINTK build
- Fix device_unregister() NULL dereference if called before class setup
- Add new documentation to MAINTAINERS
Chris Down (13):
printk: Avoid delaying messages that aren't solicited by any console
printk: Use effective loglevel for suppression and extended console
state
printk: console: Implement core per-console loglevel infrastructure
printk: Ignore per-console loglevel in sysrq
printk: Add synchronisation for concurrent console state changes
printk: Support toggling per-console loglevel via syslog() and cmdline
printk: console: Introduce sysfs interface for per-console loglevels
printk: Constrain hardware-addressed console checks to name position
printk: Support setting initial console loglevel via console= on
cmdline
printk: Add sysctl interface to set global loglevels
printk: docs: Add comprehensive guidance for per-console loglevels
printk: Deprecate the kernel.printk sysctl interface
printk: Purge default_console_loglevel
Documentation/ABI/testing/sysfs-class-console | 58 +++
Documentation/admin-guide/index.rst | 1 +
.../admin-guide/kernel-parameters.txt | 31 +-
.../admin-guide/per-console-loglevel.rst | 261 ++++++++++++++
Documentation/admin-guide/serial-console.rst | 37 +-
Documentation/admin-guide/sysctl/kernel.rst | 25 +-
Documentation/core-api/printk-basics.rst | 35 +-
Documentation/networking/netconsole.rst | 17 +
MAINTAINERS | 2 +
drivers/tty/sysrq.c | 22 ++
include/linux/console.h | 45 ++-
include/linux/printk.h | 9 +-
include/linux/sysctl.h | 7 +
kernel/printk/Makefile | 2 +-
kernel/printk/console_cmdline.h | 1 +
kernel/printk/internal.h | 20 +-
kernel/printk/nbcon.c | 4 +-
kernel/printk/printk.c | 339 ++++++++++++++++--
kernel/printk/sysctl.c | 66 +++-
kernel/printk/sysfs.c | 213 +++++++++++
kernel/sysctl.c | 18 +-
21 files changed, 1141 insertions(+), 72 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-class-console
create mode 100644 Documentation/admin-guide/per-console-loglevel.rst
create mode 100644 kernel/printk/sysfs.c
base-commit: 372a12bd5df0199aa234eaf8ef31ed7ecd61d40f
--
2.51.2
next reply other threads:[~2025-11-18 19:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 19:06 Chris Down [this message]
2025-11-18 19:06 ` [PATCH v7 01/13] printk: Avoid delaying messages that aren't solicited by any console Chris Down
2025-11-18 19:33 ` Chris Down
2025-11-19 15:46 ` Petr Mladek
2025-11-18 19:06 ` [PATCH v7 02/13] printk: Use effective loglevel for suppression and extended console state Chris Down
2025-11-18 19:07 ` [PATCH v7 03/13] printk: console: Implement core per-console loglevel infrastructure Chris Down
2025-11-18 19:34 ` Chris Down
2025-11-19 16:49 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 04/13] printk: Ignore per-console loglevel in sysrq Chris Down
2025-11-19 16:51 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 05/13] printk: Add synchronisation for concurrent console state changes Chris Down
2025-11-19 16:58 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 06/13] printk: Support toggling per-console loglevel via syslog() and cmdline Chris Down
2025-11-20 10:05 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 07/13] printk: console: Introduce sysfs interface for per-console loglevels Chris Down
2025-11-20 16:50 ` Petr Mladek
2025-11-21 11:38 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 08/13] printk: Constrain hardware-addressed console checks to name position Chris Down
2025-11-18 19:07 ` [PATCH v7 09/13] printk: Support setting initial console loglevel via console= on cmdline Chris Down
2025-11-21 14:05 ` Petr Mladek
2025-11-18 19:07 ` [PATCH v7 10/13] printk: Add sysctl interface to set global loglevels Chris Down
2025-11-21 14:23 ` Petr Mladek
2025-11-18 19:08 ` [PATCH v7 11/13] printk: docs: Add comprehensive guidance for per-console loglevels Chris Down
2025-11-21 15:52 ` Petr Mladek
2025-11-23 21:21 ` John Ogness
2025-11-18 19:08 ` [PATCH v7 12/13] printk: Deprecate the kernel.printk sysctl interface Chris Down
2025-11-18 19:08 ` [PATCH v7 13/13] printk: Purge default_console_loglevel Chris Down
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=cover.1763492585.git.chris@chrisdown.name \
--to=chris@chrisdown.name \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tony.lindgren@linux.intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.