Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: silence a lockdep complaint
@ 2024-05-22  9:15 Sagi Grimberg
  2024-05-22 12:18 ` Shinichiro Kawasaki
  0 siblings, 1 reply; 14+ messages in thread
From: Sagi Grimberg @ 2024-05-22  9:15 UTC (permalink / raw)
  To: linux-nvme; +Cc: Christoph Hellwig, Keith Busch, Shinichiro Kawasaki

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



^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-23 15:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22  9:15 [PATCH] nvme-pci: silence a lockdep complaint Sagi Grimberg
2024-05-22 12:18 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox