Re: [PATCH printk v4 5/6] printk: convert @syslog_lock to mutex

Petr Mladek
2021-07-21T12:21:37Z

On Thu 2021-07-15 21:39:58, John Ogness wrote:
> @syslog_lock was a raw_spin_lock to simplify the transition of
> removing @logbuf_lock and the safe buffers. With that transition
> complete, and since all uses of @syslog_lock are within sleepable
> contexts, @syslog_lock can become a mutex.
>
> Note that until now register_console() would disable interrupts
> using irqsave, which implies that it may be called with interrupts
> disabled. And indeed, there is one possible call chain on parisc
> where this happens:
>
> handle_interruption(code=1) /* High-priority machine check (HPMC) */
> pdc_console_restart()
> pdc_console_init_force()
> register_console()
>
> However, register_console() calls console_lock(), which might sleep.
> So it has never been allowed to call register_console() from an
> atomic context and the above call chain is a bug.
>
> Note that the removal of read_syslog_seq_irq() is slightly changing
> the behavior of SYSLOG_ACTION_READ by testing against a possibly
> outdated @seq value. However, the value of @seq could have changed
> after the test, so it is not a new window. A follow-up commit closes
> this window.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr