• John Ogness's avatar
    printk: convert @syslog_lock to mutex · b371cbb5
    John Ogness authored
    @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: default avatarJohn Ogness <john.ogness@linutronix.de>
    Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
    Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
    Link: https://lore.kernel.org/r/20210715193359.25946-6-john.ogness@linutronix.de
    b371cbb5
printk.c 93.9 KB