From: Pavel Machek <pavel@ucw.cz>
To: Andrea Righi <andrea.righi@canonical.com>
Cc: Boqun Feng <boqun.feng@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: lockdep: possible irq lock inversion dependency detected (trig->leddev_list_lock)
Date: Sun, 1 Nov 2020 17:28:38 +0100 [thread overview]
Message-ID: <20201101162838.GA24370@duo.ucw.cz> (raw)
In-Reply-To: <20201101092614.GB3989@xps-13-7390>
[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]
Hi!
> I'm getting the following lockdep splat (see below).
>
> Apparently this warning starts to be reported after applying:
>
> e918188611f0 ("locking: More accurate annotations for read_lock()")
>
> It looks like a false positive to me, but it made me think a bit and
> IIUC there can be still a potential deadlock, even if the deadlock
> scenario is a bit different than what lockdep is showing.
>
> In the assumption that read-locks are recursive only in_interrupt()
> context (as stated in e918188611f0), the following scenario can still
> happen:
>
> CPU0 CPU1
> ---- ----
> read_lock(&trig->leddev_list_lock);
> write_lock(&trig->leddev_list_lock);
> <soft-irq>
> kbd_bh()
> -> read_lock(&trig->leddev_list_lock);
>
> *** DEADLOCK ***
>
> The write-lock is waiting on CPU1 and the second read_lock() on CPU0
> would be blocked by the write-lock *waiter* on CPU1 => deadlock.
>
> In that case we could prevent this deadlock condition using a workqueue
> to call kbd_propagate_led_state() instead of calling it directly from
> kbd_bh() (even if lockdep would still report the false positive).
console.c is already using bh to delay work from
interrupt. But... that should not be neccessary. led_trigger_event
should already be callable from interrupt context, AFAICT.
Could this be resolved by doing the operations directly from keyboard
interrupt?
Best regards,
Pavel
--
HTTP://www.livejournal.com/~pavelmachek
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2020-11-01 16:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-01 9:26 Andrea Righi
2020-10-31 10:17 ` Boqun Feng
2020-11-02 7:33 ` Andrea Righi
2020-11-02 8:56 ` Pavel Machek
2020-11-02 9:09 ` Andrea Righi
2020-11-06 7:40 ` Andrea Righi
2020-11-01 16:28 ` Pavel Machek [this message]
2020-11-02 7:39 ` Andrea Righi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201101162838.GA24370@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=andrea.righi@canonical.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
--subject='Re: lockdep: possible irq lock inversion dependency detected (trig->leddev_list_lock)' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).