Skip to content

Commit

Permalink
printk: refactor and rework printing logic
Browse files Browse the repository at this point in the history
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
  • Loading branch information
John Ogness authored and Petr Mladek committed Apr 22, 2022
1 parent 1fc0ca9 commit a699449
Show file tree
Hide file tree
Showing 2 changed files with 230 additions and 213 deletions.
2 changes: 2 additions & 0 deletions include/linux/console.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ struct console {
int cflag;
uint ispeed;
uint ospeed;
u64 seq;
unsigned long dropped;
void *data;
struct console *next;
};
Expand Down
Loading

0 comments on commit a699449

Please sign in to comment.