From: David Hildenbrand <david@redhat.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
Baoquan He <bhe@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vivek Goyal <vgoyal@redhat.com>, Dave Young <dyoung@redhat.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v1] proc/vmcore: fix false positive lockdep warning
Date: Wed, 19 Jan 2022 16:15:16 +0100 [thread overview]
Message-ID: <ec19d477-a75c-1e5a-1c02-f62c8565f48d@redhat.com> (raw)
In-Reply-To: <YegpdRBSrkVBrwk3@boqun-archlinux>
On 19.01.22 16:08, Boqun Feng wrote:
> Hi,
>
> On Wed, Jan 19, 2022 at 12:37:02PM +0100, David Hildenbrand wrote:
>> Lockdep complains that we do during mmap of the vmcore:
>> down_write(mmap_lock);
>> down_read(vmcore_cb_rwsem);
>> And during read of the vmcore:
>> down_read(vmcore_cb_rwsem);
>> down_read(mmap_lock);
>>
>> We cannot possibly deadlock when only taking vmcore_cb_rwsem in read
>> mode, however, it's hard to teach that to lockdep.
>>
>
> Lockdep warned about the above sequences because rw_semaphore is a fair
> read-write lock, and the following can cause a deadlock:
>
> TASK 1 TASK 2 TASK 3
> ====== ====== ======
> down_write(mmap_lock);
> down_read(vmcore_cb_rwsem)
> down_write(vmcore_cb_rwsem); // blocked
> down_read(vmcore_cb_rwsem); // cannot get the lock because of the fairness
> down_read(mmap_lock); // blocked
>
> IOW, a reader can block another read if there is a writer queued by the
> second reader and the lock is fair.
>
> So there is a deadlock possiblity.
Task 3 will never take the mmap_lock before doing a
down_write(vmcore_cb_rwsem).
How would this happen?
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-01-19 15:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 11:37 [PATCH v1] proc/vmcore: fix false positive lockdep warning David Hildenbrand
2022-01-19 15:08 ` Boqun Feng
2022-01-19 15:15 ` David Hildenbrand [this message]
2022-01-19 15:19 ` David Hildenbrand
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=ec19d477-a75c-1e5a-1c02-f62c8565f48d@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=dyoung@redhat.com \
--cc=josh@joshtriplett.org \
--cc=kexec@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=vgoyal@redhat.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).