linux/kernel/printk
John Ogness adf6f37d14 nbcon: Add API to acquire context for non-printing operations
Provide functions nbcon_device_try_acquire() and
nbcon_device_release() which will try to acquire the nbcon
console ownership with NBCON_PRIO_NORMAL and mark it unsafe for
handover/takeover.

These functions are to be used together with the device-specific
locking when performing non-printing activities on the console
device. They will allow synchronization against the
atomic_write() callback which will be serialized, for higher
priority contexts, only by acquiring the console context
ownership.

Pitfalls:

The API requires to be called in a context with migration
disabled because it uses per-CPU variables internally.

The context is set unsafe for a takeover all the time. It
guarantees full serialization against any atomic_write() caller
except for the final flush in panic() which might try an unsafe
takeover.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-14-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
2024-08-21 14:56:23 +02:00
..
braille.c printk: Replace strncmp() with str_has_prefix() 2019-08-16 09:54:08 +02:00
braille.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
console_cmdline.h printk: Add match_devname_and_update_preferred_console() 2024-07-04 15:41:44 +02:00
index.c kernel/printk/index.c: fix memory leak with using debugfs_lookup() 2023-02-03 10:42:02 +01:00
internal.h printk: Check printk_deferred_enter()/_exit() usage 2024-08-21 14:56:22 +02:00
Makefile Revert "printk: Save console options for add_preferred_console_match()" 2024-06-25 07:58:10 +02:00
nbcon.c nbcon: Add API to acquire context for non-printing operations 2024-08-21 14:56:23 +02:00
printk_ringbuffer.c printk: ringbuffer: Skip non-finalized records in panic 2024-02-07 17:23:18 +01:00
printk_ringbuffer.h printk: Wait for all reserved records with pr_flush() 2024-02-07 17:23:18 +01:00
printk_safe.c printk: Check printk_deferred_enter()/_exit() usage 2024-08-21 14:56:22 +02:00
printk.c printk: nbcon: Use driver synchronization while (un)registering 2024-08-21 14:56:23 +02:00
sysctl.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00