public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>, linux-block@vger.kernel.org
Subject: Re: [PATCH 4/5] block: always verify unfreeze lock on the owner task
Date: Wed, 30 Oct 2024 22:53:46 +0800	[thread overview]
Message-ID: <ZyJIcPFQb13mJ8K3@fedora> (raw)
In-Reply-To: <20241030144614.GC32043@lst.de>

On Wed, Oct 30, 2024 at 03:46:14PM +0100, Christoph Hellwig wrote:
> On Wed, Oct 30, 2024 at 08:42:36PM +0800, Ming Lei wrote:
> > commit f1be1788a32e ("block: model freeze & enter queue as lock for
> > supporting lockdep") tries to apply lockdep for verifying freeze &
> > unfreeze. However, the verification is only done the outmost freeze and
> > unfreeze. This way is actually not correct because q->mq_freeze_depth
> > still may drop to zero on other task instead of the freeze owner task.
> 
> Well, that's how non-owner functions work in general.
> 
> > Fix this issue by always verifying the last unfreeze lock on the owner
> > task context, and freeze lock is still verified on the outmost one.
> > 
> > Fixes: f1be1788a32e ("block: model freeze & enter queue as lock for supporting lockdep")
> 
> What does this actually fix vs just improving coverage?  Because the
> hacks in here look pretty horrible and I'd be much happier if we didn't
> have them.
 
task A								task B

blk_mq_freeze_queue()
									blk_mq_freeze_queue()

blk_mq_unfreeze_queue()
									blk_mq_unfreeze_queue()


freeze_queue is verified on task A, but unfreeze_queue is verified on
task B, this way is definitely wrong.

This patch moves unfreeze_queue verification on task A.


Thanks, 
Ming


  reply	other threads:[~2024-10-30 14:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 12:42 [PATCH 0/5] block: freeze/unfreeze lockdep fixes Ming Lei
2024-10-30 12:42 ` [PATCH 1/5] block: remove blk_freeze_queue() Ming Lei
2024-10-30 14:43   ` Christoph Hellwig
2024-10-30 12:42 ` [PATCH 2/5] blk-mq: add non_owner variant of blk_mq_freeze_queue API Ming Lei
2024-10-30 12:42 ` [PATCH 3/5] rbd: convert to blk_mq_freeze_queue_non_owner Ming Lei
2024-10-30 14:44   ` Christoph Hellwig
2024-10-30 15:02     ` Ming Lei
2024-10-30 12:42 ` [PATCH 4/5] block: always verify unfreeze lock on the owner task Ming Lei
2024-10-30 14:46   ` Christoph Hellwig
2024-10-30 14:53     ` Ming Lei [this message]
2024-10-30 12:42 ` [PATCH 5/5] block: don't verify IO lock for freeze/unfreeze in elevator_init_mq() Ming Lei
2024-10-30 14:46   ` Christoph Hellwig
2024-10-30 14:59     ` Ming Lei

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=ZyJIcPFQb13mJ8K3@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.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