printk: refactor and rework printing logic
authorJohn Ogness <john.ogness@linutronix.de>
Thu, 21 Apr 2022 21:22:44 +0000 (23:28 +0206)
committerPetr Mladek <pmladek@suse.com>
Fri, 22 Apr 2022 19:30:57 +0000 (21:30 +0200)
commita699449bb13b70b8bd10dc03ad7327ea3993221e
tree3579b59c7edc475013ae769a2d26d99733c95f13
parent1fc0ca9e0db61882208650b3603071e9f4b5cfee
printk: refactor and rework printing logic

Refactor/rework printing logic in order to prepare for moving to
threaded console printing.

- Move @console_seq into struct console so that the current
  "position" of each console can be tracked individually.

- Move @console_dropped into struct console so that the current drop
  count of each console can be tracked individually.

- Modify printing logic so that each console independently loads,
  prepares, and prints its next record.

- Remove exclusive_console logic. Since console positions are
  handled independently, replaying past records occurs naturally.

- Update the comments explaining why preemption is disabled while
  printing from printk() context.

With these changes, there is a change in behavior: the console
replaying the log (formerly exclusive console) will no longer block
other consoles. New messages appear on the other consoles while the
newly added console is still replaying.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220421212250.565456-10-john.ogness@linutronix.de
include/linux/console.h
kernel/printk/printk.c