Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: linux-nvme@lists.infradead.org
Cc: Christoph Hellwig <hch@lst.de>, Keith Busch <kbusch@kernel.org>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH] nvme-pci: silence a lockdep complaint
Date: Wed, 22 May 2024 12:15:34 +0300	[thread overview]
Message-ID: <20240522091534.472449-1-sagi@grimberg.me> (raw)

lockdep complains about the timeout handler running concurrently with
the reset work which is syncing the IO request queues (which in turn
flushes the timeout work).

We know it cannot be the case because the ctrl state machine prevents
the timeout handler from disabling the ctrl when the reset work is
running (changing ctrl state to RESETTING will fail, and the state is not
terminal). If this assumption happens to break in the future, we won't
have lockdep to assist, but for the time being we are simply seeing
false-positive complaints from it...

Reported-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Suggested-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/pci.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 710043086dff..4a85b83b78f9 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2718,7 +2718,18 @@ static void nvme_reset_work(struct work_struct *work)
 	 */
 	if (dev->ctrl.ctrl_config & NVME_CC_ENABLE)
 		nvme_dev_disable(dev, false);
+	/*
+	 * lockdep complains about the timeout handler running concurrently
+	 * with this call. We know it cannot be the case because the ctrl state
+	 * machine prevents the timeout handler from disabling the ctrl when
+	 * the reset work is running (changing ctrl state to RESETTING will
+	 * fail, and the state is not terminal). If this assumption happens to
+	 * break in the future, we won't have lockdep to assist, but for the
+	 * time being we are simply seeing false-positive complaints from it...
+	 */
+	lockdep_off();
 	nvme_sync_queues(&dev->ctrl);
+	lockdep_on();
 
 	mutex_lock(&dev->shutdown_lock);
 	result = nvme_pci_enable(dev);
-- 
2.40.1



             reply	other threads:[~2024-05-22  9:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22  9:15 Sagi Grimberg [this message]
2024-05-22 12:18 ` [PATCH] nvme-pci: silence a lockdep complaint Shinichiro Kawasaki
2024-05-22 16:12   ` Keith Busch
2024-05-22 16:28     ` Christoph Hellwig
2024-05-22 18:00       ` Sagi Grimberg
2024-05-22 21:36         ` Keith Busch
2024-05-23  6:54           ` Christoph Hellwig
2024-05-23 10:04             ` Sagi Grimberg
2024-05-23 12:39               ` Christoph Hellwig
2024-05-23 13:02                 ` Sagi Grimberg
2024-05-23 13:19                   ` Christoph Hellwig
2024-05-23 13:45                     ` Sagi Grimberg
2024-05-23 15:02                       ` Keith Busch
2024-05-23  8:06           ` Christoph Hellwig

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=20240522091534.472449-1-sagi@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=shinichiro.kawasaki@wdc.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