From: Christoph Hellwig <hch@lst.de>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: model freeze & enter queue as rwsem for supporting lockdep
Date: Wed, 23 Oct 2024 08:07:15 +0200 [thread overview]
Message-ID: <20241023060715.GA2468@lst.de> (raw)
In-Reply-To: <ZxhsD2zZLnZVaGZf@fedora>
On Wed, Oct 23, 2024 at 11:22:55AM +0800, Ming Lei wrote:
> > > 2) model blk_enter_queue() as down_read()
> > > - it is shared lock, so concurrent blk_enter_queue() are allowed
> > > - it is read lock, so dependency with blk_mq_freeze_queue() is modeled
> > > - blk_queue_exit() is often called from other contexts(such as irq), and
> > > it can't be annotated as rwsem_release(), so simply do it in
> > > blk_enter_queue(), this way still covered cases as many as possible
> > >
> > > NVMe is the only subsystem which may call blk_mq_freeze_queue() and
> > > blk_mq_unfreeze_queue() from different context, so it is the only
> > > exception for the modeling. Add one tagset flag to exclude it from
> > > the lockdep support.
> >
> > rwsems have a non_owner variant for these kinds of uses cases,
> > we should do the same for blk_mq_freeze_queue to annoate the callsite
> > instead of a global flag.
>
> Here it isn't real rwsem, and lockdep doesn't have non_owner variant
> for rwsem_acquire() and rwsem_release().
Hmm, it looks like down_read_non_owner completely skips lockdep,
which seems rather problematic. Sure we can't really track an
owner, but having it take part in the lock chain would be extremely
useful. Whatever we're using there should work for the freeze
protection.
> Another corner case is blk_mark_disk_dead() in which freeze & unfreeze
> may be run from different task contexts too.
Yes, this is a pretty questionable one though as we should be able
to unfreeze as soon as the dying bit is set. Separate discussion,
though.
Either way the non-ownership should be per call and not a queue or
tagset flag.
next prev parent reply other threads:[~2024-10-23 6:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-18 1:35 [PATCH] block: model freeze & enter queue as rwsem for supporting lockdep Ming Lei
2024-10-18 16:57 ` Bart Van Assche
2024-10-21 2:20 ` Ming Lei
2024-10-22 6:26 ` Christoph Hellwig
2024-10-18 18:45 ` kernel test robot
2024-10-19 22:46 ` Jens Axboe
2024-10-21 11:17 ` Ming Lei
2024-10-22 6:18 ` Christoph Hellwig
2024-10-22 7:19 ` Peter Zijlstra
2024-10-22 7:21 ` Christoph Hellwig
2024-10-23 3:22 ` Ming Lei
2024-10-23 6:07 ` Christoph Hellwig [this message]
2024-10-22 15:05 ` Bart Van Assche
2024-10-23 7:59 ` Ming Lei
2024-10-23 18:05 ` Bart Van Assche
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=20241023060715.GA2468@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=boqun.feng@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=ming.lei@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/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).