From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Keith Busch <kbusch@kernel.org>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Tejun Heo <tj@kernel.org>,
Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Damien Le Moal <damien.lemoal@opensource.wdc.com>
Subject: Re: lockdep WARNING at blktests block/011
Date: Tue, 4 Oct 2022 10:44:57 +0000 [thread overview]
Message-ID: <20221004104456.ik42oxynyujsu5vb@shindev> (raw)
In-Reply-To: <Yzr/pBvvq0NCzGwV@kbusch-mbp.dhcp.thefacebook.com>
On Oct 03, 2022 / 09:28, Keith Busch wrote:
> On Mon, Oct 03, 2022 at 01:32:41PM +0000, Shinichiro Kawasaki wrote:
> >
> > BTW, I came up to another question during code read. I found nvme_reset_work()
> > calls nvme_dev_disable() before nvme_sync_queues(). So, I think the NVME
> > controller is already disabled when the reset work calls nvme_sync_queues().
>
> Right, everything previously outstanding has been reclaimed, and the queues are
> quiesced at this point. There's nothing for timeout work to wait for, and the
> sync is just ensuring every timeout work has returned.
Thank you Keith, good to know that we do not need to worry about the deadlock
scenario with nvme_reset_work() :) I also checked nvme_reset_prepare() and
nvme_suspend(). They also call nvme_dev_disable() or nvme_start/wait_freeze()
before nvme_sync_queues(). So I think the queues are quiesced in these context
also, and do not worry them either.
>
> It looks like a timeout is required in order to hit this reported deadlock, but
> the driver ensures there's nothing to timeout prior to syncing the queues. I
> don't think lockdep could reasonably know that, though.
I see... From blktests point of view, I would like to suppress the lockdep splat
which triggers the block/011 failure. I created a quick patch using
lockdep_off() and lockdep_on() which skips lockdep check for the read lock in
nvme_sync_io_queues() [1] and confirmed it avoids the lockdep splat. I think
this lockdep check relax is fine because nvme_sync_io_queues() callers do call
nvme_dev_disable(), nvme_start/wait_freeze() or nvme_stop_queues(). The queues
are quiesced at nvme_sync_io_queues() and the deadlock scenario does not happen.
Any comment on this patch will be appreciated. If this action approach is ok,
I'll post as a formal patch for review.
[1]
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 66446f1e06c..9d091327a88 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -5121,10 +5121,14 @@ void nvme_sync_io_queues(struct nvme_ctrl *ctrl)
{
struct nvme_ns *ns;
+ lockdep_off();
down_read(&ctrl->namespaces_rwsem);
+ lockdep_on();
list_for_each_entry(ns, &ctrl->namespaces, list)
blk_sync_queue(ns->queue);
+ lockdep_off();
up_read(&ctrl->namespaces_rwsem);
+ lockdep_on();
}
EXPORT_SYMBOL_GPL(nvme_sync_io_queues);
--
Shin'ichiro Kawasaki
next prev parent reply other threads:[~2022-10-04 10:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-30 0:19 lockdep WARNING at blktests block/011 Shinichiro Kawasaki
2022-09-30 11:06 ` Tetsuo Handa
2022-10-03 13:32 ` Shinichiro Kawasaki
2022-10-03 15:28 ` Keith Busch
2022-10-04 10:44 ` Shinichiro Kawasaki [this message]
2022-10-04 11:10 ` Tetsuo Handa
2022-10-04 12:23 ` Shinichiro Kawasaki
2022-10-05 8:31 ` Shinichiro Kawasaki
2022-10-05 10:00 ` Tetsuo Handa
2022-10-05 14:20 ` Keith Busch
2022-10-06 2:30 ` Shinichiro Kawasaki
2022-10-07 1:36 ` Shinichiro Kawasaki
2022-10-04 22:34 ` Damien Le Moal
2022-10-07 20:34 ` Bart Van Assche
2022-10-10 13:31 ` Keith Busch
2022-10-11 17:11 ` 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=20221004104456.ik42oxynyujsu5vb@shindev \
--to=shinichiro.kawasaki@wdc.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=tj@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