Skip to content

Commit

Permalink
printk: console: remove unnecessary safe buffer usage
Browse files Browse the repository at this point in the history
Upon registering a console, safe buffers are activated when setting
up the sequence number to replay the log. However, these are already
protected by @console_sem and @syslog_lock. Remove the unnecessary
safe buffer usage.

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/20210303101528.29901-16-john.ogness@linutronix.de
  • Loading branch information
jogness authored and pmladek committed Mar 8, 2021
1 parent a4f9876 commit 505a27a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions kernel/printk/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -2967,9 +2967,7 @@ void register_console(struct console *newcon)
/*
* console_unlock(); will print out the buffered messages
* for us.
*/
printk_safe_enter_irqsave(flags);
/*
*
* We're about to replay the log buffer. Only do this to the
* just-registered console to avoid excessive message spam to
* the already-registered consoles.
Expand All @@ -2982,11 +2980,9 @@ void register_console(struct console *newcon)
exclusive_console_stop_seq = console_seq;

/* Get a consistent copy of @syslog_seq. */
raw_spin_lock(&syslog_lock);
raw_spin_lock_irqsave(&syslog_lock, flags);
console_seq = syslog_seq;
raw_spin_unlock(&syslog_lock);

printk_safe_exit_irqrestore(flags);
raw_spin_unlock_irqrestore(&syslog_lock, flags);
}
console_unlock();
console_sysfs_notify();
Expand Down

0 comments on commit 505a27a

Please sign in to comment.