[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0ifful4.ffs@tglx>
Date: Wed, 17 Jan 2024 23:44:55 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Leonardo Bras <leobras@...hat.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Jiri Slaby <jirislaby@...nel.org>, Ilpo
Järvinen <ilpo.jarvinen@...ux.intel.com>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Florian Fainelli
<f.fainelli@...il.com>, John Ogness <john.ogness@...utronix.de>, Tony
Lindgren <tony@...mide.com>, Marcelo Tosatti <mtosatti@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org, Sebastian
Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [RESEND RFC PATCH v1 2/2] serial/8250: Avoid getting lock in RT
atomic context
On Tue, Jan 16 2024 at 04:37, Leonardo Bras wrote:
> With PREEMPT_RT enabled, a spin_lock_irqsave() becomes a possibly sleeping
> spin_lock(), without preempt_disable() or irq_disable().
>
> This allows a task T1 to get preempted or interrupted while holding the
> port->lock. If the preempting task T2 need the lock, spin_lock() code
> will schedule T1 back until it finishes using the lock, and then go back to
> T2.
>
> There is an issue if a T1 holding port->lock is interrupted by an
> IRQ, and this IRQ handler needs to get port->lock for writting (printk):
> spin_lock() code will try to reschedule the interrupt handler, which is in
> atomic context, causing a BUG() for trying to reschedule/sleep in atomic
> context.
>
> So for the case (PREEMPT_RT && in_atomic()) try to get the lock, and if it
> fails proceed anyway, just like it's done in oops_in_progress case.
That's just blantantly wrong. The locks are really only to be ignored
for the oops case, but not for regular printk.
I assume that this is not against the latest RT kernel as that should
not have that problem at all.
Thanks,
tglx
Powered by blists - more mailing lists