LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v3] nvme: fix lockdep warning in nvme_mpath_clear_current_path
@ 2018-05-17 11:52 Johannes Thumshirn
  2018-05-23 14:54 ` Johannes Thumshirn
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2018-05-17 11:52 UTC (permalink / raw)
  To: Keith Busch
  Cc: Sagi Grimberg, Christoph Hellwig, Linux NVMe Mailinglist,
	Linux Kernel Mailinglist, Hannes Reinecke, Johannes Thumshirn

When running blktest's nvme/005 with a lockdep enabled kernel the test
case fails due to the following lockdep splat in dmesg:

 =============================
 WARNING: suspicious RCU usage
 4.17.0-rc5 #881 Not tainted
 -----------------------------
 drivers/nvme/host/nvme.h:457 suspicious rcu_dereference_check() usage!

 other info that might help us debug this:

 rcu_scheduler_active = 2, debug_locks = 1
 3 locks held by kworker/u32:5/1102:
  #0:         (ptrval) ((wq_completion)"nvme-wq"){+.+.}, at: process_one_work+0x152/0x5c0
  #1:         (ptrval) ((work_completion)(&ctrl->scan_work)){+.+.}, at: process_one_work+0x152/0x5c0
  #2:         (ptrval) (&subsys->lock#2){+.+.}, at: nvme_ns_remove+0x43/0x1c0 [nvme_core]

The only caller of nvme_mpath_clear_current_path() is nvme_ns_remove()
which holds the subsys lock so it's likely a false positive, but when
using rcu_access_pointer(), we're telling rcu and lockdep that we're
only after the pointer falue.

Fixes: 32acab3181c7 ("nvme: implement multipath access to nvme subsystems")
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Suggested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>

---
Changes to v2:
- Added Christoph's R-b
- Removed most of the lockdep splat from commit log

Changes to v1:
- Change rcu_dereference_protected() to rc_access_pointer() (Paul)

---
 drivers/nvme/host/nvme.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 17d2f7cf3fed..af2bb6bc984d 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -22,6 +22,7 @@
 #include <linux/lightnvm.h>
 #include <linux/sed-opal.h>
 #include <linux/fault-inject.h>
+#include <linux/rcupdate.h>
 
 extern unsigned int nvme_io_timeout;
 #define NVME_IO_TIMEOUT	(nvme_io_timeout * HZ)
@@ -454,7 +455,7 @@ static inline void nvme_mpath_clear_current_path(struct nvme_ns *ns)
 {
 	struct nvme_ns_head *head = ns->head;
 
-	if (head && ns == srcu_dereference(head->current_path, &head->srcu))
+	if (head && ns == rcu_access_pointer(head->current_path))
 		rcu_assign_pointer(head->current_path, NULL);
 }
 struct nvme_ns *nvme_find_path(struct nvme_ns_head *head);
-- 
2.16.3

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

* Re: [PATCH v3] nvme: fix lockdep warning in nvme_mpath_clear_current_path
  2018-05-17 11:52 [PATCH v3] nvme: fix lockdep warning in nvme_mpath_clear_current_path Johannes Thumshirn
@ 2018-05-23 14:54 ` Johannes Thumshirn
  2018-05-23 15:08   ` Keith Busch
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Thumshirn @ 2018-05-23 14:54 UTC (permalink / raw)
  To: Keith Busch
  Cc: Sagi Grimberg, Christoph Hellwig, Linux NVMe Mailinglist,
	Linux Kernel Mailinglist, Hannes Reinecke

Keith, Sagi, Christoph ping?
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

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

* Re: [PATCH v3] nvme: fix lockdep warning in nvme_mpath_clear_current_path
  2018-05-23 14:54 ` Johannes Thumshirn
@ 2018-05-23 15:08   ` Keith Busch
  0 siblings, 0 replies; 3+ messages in thread
From: Keith Busch @ 2018-05-23 15:08 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Keith Busch, Linux Kernel Mailinglist, Hannes Reinecke,
	Sagi Grimberg, Linux NVMe Mailinglist, Christoph Hellwig

Thanks for the ping. I started a new branch, nvme-4.18-2, based off of
Jens' for-next with this being the first new commit.

I'm certain we're still missing a lot of reviewed commits. I'll try to
go through the mail history and apply by the end of the week, but any
friendly reminders would not be unappreciated. :)

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 11:52 [PATCH v3] nvme: fix lockdep warning in nvme_mpath_clear_current_path Johannes Thumshirn
2018-05-23 14:54 ` Johannes Thumshirn
2018-05-23 15:08   ` Keith Busch

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).