Skip to content

printk: console: Per-console loglevels

Chris Down lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v6 Latest11 patches 38 repliesIn review

Changes in v6 from the cover letter · 25 lines

- 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

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11printk: Avoid delaying messages that aren't solicited by any consolekernel/printk/printk.c+7 -60 replies
2/11printk: Use struct console for suppression and extended console statekernel/printk/internal.h kernel/printk/nbcon.c kernel/printk/printk.c+23 -164 replies
3/11printk: console: Implement core per-console loglevel infrastructuredrivers/tty/sysrq.c include/linux/console.h include/linux/printk.h +2 more+106 -43 replies
4/11printk: Support toggling per-console loglevel via syslog() and cmdlineDocumentation/admin-guide/index.rst Documentation/admin-guide/per-console-loglevel.rst MAINTAINERS +3 more+116 -27 replies
5/11MAINTAINERS: Mark printk-basics.rst as owned by printk subsystemMAINTAINERS+1 -03 replies
6/11printk: console: Introduce sysfs interface for per-console loglevelsDocumentation/ABI/testing/sysfs-class-console Documentation/admin-guide/per-console-loglevel.rst Documentation/core-api/printk-basics.rst +8 more+324 -1814 replies
7/11printk: Constrain hardware-addressed console checks to name positionkernel/printk/printk.c+8 -22 replies
8/11printk: Support setting initial console loglevel via console= on cmdlineDocumentation/admin-guide/kernel-parameters.txt Documentation/admin-guide/serial-console.rst Documentation/networking/netconsole.rst +2 more+140 -151 reply
9/11printk: Add sysctl interface to set global loglevelsDocumentation/admin-guide/sysctl/kernel.rst kernel/printk/sysctl.c+57 -22 replies
10/11printk: Deprecate the kernel.printk sysctl interfaceDocumentation/admin-guide/sysctl/kernel.rst kernel/printk/sysctl.c+16 -11 reply
11/11printk: Purge default_console_loglevelDocumentation/admin-guide/sysctl/kernel.rst include/linux/printk.h kernel/printk/printk.c+3 -51 reply

Reviews trailers per patch

6 of 11 patches have a Reviewed-by or Acked-by.

PatchPetr MladekTony Lindgren
1/11R-b
2/11R-b
3/11
4/11
5/11R-b
6/11
7/11R-b R-b
8/11
9/11
10/11R-b
11/11R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 00/11] printk: console: Per-console loglevels

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 (11):
printk: Avoid delaying messages that aren't solicited by any console
printk: Use struct console for suppression and extended console state
printk: console: Implement core per-console loglevel infrastructure
printk: Support toggling per-console loglevel via syslog() and cmdline
MAINTAINERS: Mark printk-basics.rst as owned by printk subsystem
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: Deprecate the kernel.printk sysctl interface
printk: Purge default_console_loglevel

 Documentation/ABI/testing/sysfs-class-console |  47 +++
 Documentation/admin-guide/index.rst           |   1 +
 .../admin-guide/kernel-parameters.txt         |  24 +-
 .../admin-guide/per-console-loglevel.rst      | 111 ++++++++
 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                                   |   3 +
 drivers/tty/sysrq.c                           |  20 ++
 include/linux/console.h                       |   5 +
 include/linux/printk.h                        |  10 +-
 kernel/printk/Makefile                        |   2 +-
 kernel/printk/console_cmdline.h               |   1 +
 kernel/printk/internal.h                      |  19 +-
 kernel/printk/nbcon.c                         |   2 +-
 kernel/printk/printk.c                        | 267 ++++++++++++++++--
 kernel/printk/sysctl.c                        |  56 +++-
 kernel/printk/sysfs.c                         | 178 ++++++++++++
 19 files changed, 795 insertions(+), 65 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: 81983758430957d9a5cb3333fe324fd70cf63e7e

Signature · 1 line
2.46.0