Re: [PATCH] serial: 8250: drop lockdep annotation from serial8250_clear_IER()

From: Jiri Slaby
Date: Mon Aug 14 2023 - 02:29:39 EST


On 14. 08. 23, 8:15, John Ogness wrote:
On 2023-08-11, "Jiri Slaby (SUSE)" <jirislaby@xxxxxxxxxx> wrote:
The port lock is not always held when calling serial8250_clear_IER().
When an oops is in progress, the lock is tried to be taken and when it
is not, a warning is issued:

Yes, and that is a potential deadlock. The warning is correct.

Could you elaborate on how can not-taking a lock be a potential deadlock?

Therefore, remove the annotation as it doesn't hold for all invocations.

... because those invocations are broken by design.

Perhaps. But the system is crashing. Better to emit something without the lock rather than nothing (and wait for the lock infinitely).

The other option would be to make the lockdep test conditional on
'oops_in_progress' or pass 'locked' from serial8250_console_write(). I
don't think, that is worth it.

The proper thing to do is to fix the invocation. The upcoming atomic
console implementation for the 8250 does exactly that.

So what does it do?

If this patch gets accepted (which it appears it will be), I will revert
it in my series implementing the 8250 atomic console.

That's fine as soon as the warning is not a problem.

thanks,
--
js
suse labs