lkml.org 
[lkml]   [2021]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH next v1 3/3] printk: convert @syslog_lock to spin_lock
Date
On 2021-03-23, Petr Mladek <pmladek@suse.com> wrote:

> On Wed 2021-03-17 00:33:26, John Ogness wrote:
>> @syslog_log was a raw_spin_lock to simplify the transition of
>
> s/syslog_log/syslog_lock/
>
> Same problem is also below.

Right.

>> removing @logbuf_lock and the safe buffers. With that transition
>> complete, @syslog_log can become a spin_lock.
>
> I know that we already talked about this. But I want to be sure
> that this patch makes sense.
>
> It will actually not change the behavior because we always
> take the lock with interrupts disabled.
>
> We disable the interrupts because register_console() is called
> in IRQ context on parisc in handle_interruption() when it is
> going to panic (code == 1 => will call parisc_terminate()).

Yes. [0]

> Disabling IRQ will not help in parisc_terminate(). This code
> path is non-maskable and never returns. The deadlock might be
> prevented only by trylock.
>
> trylock on syslog_lock is only small problem. Much bigger is
> is a deadlock on console_lock. Fixing this is beyond this
> patchset.
>
> Summary:
>
> + disabling IRQ does not help for parisc
>
> + register_console() is not irq safe in general because
> of the sleeping console_lock.
>
>
> I would personally prefer to remove both "raw" and "irq"
> in this patch and just document the problem with parisc
> in the commit message.
>
> IMHO, it does not make sense to keep _irq when it neither
> helps nor makes sense.

I agree. I will change it for v2 and note in the commit message that the
parisc call chain:

handle_interruption(code=1) /* High-priority machine check (HPMC) */
pdc_console_restart()
pdc_console_init_force()
register_console()

is unsafe and is the only register_console() user in atomic context.

John Ogness

[0] https://lore.kernel.org/lkml/8735xs10hi.fsf@jogness.linutronix.de

\
 
 \ /
  Last update: 2021-03-26 12:25    [W:0.258 / U:1.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site