From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org,
Leon Romanovsky <leon@kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Keith Busch <kbusch@kernel.org>,
Surabhi Gogte <sgogte@purestorage.com>
Subject: Re: [PATCH RFC 2/2] nvmet-rdma: use a separate lockdep class for the listening cm_id
Date: Wed, 11 Nov 2026 14:01:58 +0900 [thread overview]
Message-ID: <avP07JWvBtMboL8k@shinmob> (raw)
In-Reply-To: <20261110003243.GS663069@ziepe.ca>
Jason, thank you for the comments.
On Nov 09, 2026 / 20:32, Jason Gunthorpe wrote:
> On Sun, Nov 08, 2026 at 09:01:54PM +0900, Shin'ichiro Kawasaki wrote:
> > @@ -1914,6 +1914,8 @@ static int nvmet_rdma_enable_port(struct nvmet_rdma_port *port)
> > return PTR_ERR(cm_id);
> > }
> >
> > + rdma_reclassify_id_for_listen(cm_id);
> > +
>
> It seems like a flag or new function for the create would make more
> sense,
I see, new function approach sounds better than this patch.
> and if this is the right fix then all the callers with the
> pattern of rdma_create_id() .. rdma_listen() should be fixed too?
I agree that it is ideal to apply the same change to the all the callers.
>
> I suppose we cannot change the lock class in rdma_listen ?
Oh, this approach sounds the best. It modifies only RDMA driver, and can cover
all the callers. I did a quick trial with the change below, and confirmed it
avoids the WARN. So this approach works well :) I will wait some more days for
comments. If there is no other voices, I will post this solution as a formal
patch.
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 337a49d1acf7..334f39c2f5e5 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -3949,6 +3949,12 @@ int rdma_listen(struct rdma_cm_id *id, int backlog)
container_of(id, struct rdma_id_private, id);
int ret;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ static struct lock_class_key cma_listen_handler_mutex_key;
+ lockdep_set_class(&id_priv->handler_mutex,
+ &cma_listen_handler_mutex_key);
+#endif
+
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_LISTEN)) {
struct sockaddr_in any_in = {
.sin_family = AF_INET,
next prev parent reply other threads:[~2026-11-11 5:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 12:01 [PATCH RFC 0/2] RDMA/cma, nvmet-rdma: fix a lockdep WARN Shin'ichiro Kawasaki
2026-11-08 12:01 ` [PATCH RFC 1/2] RDMA/cma: Add rdma_reclassify_id_for_listen() Shin'ichiro Kawasaki
2026-11-08 12:16 ` sashiko-bot
2026-11-08 12:01 ` [PATCH RFC 2/2] nvmet-rdma: use a separate lockdep class for the listening cm_id Shin'ichiro Kawasaki
2026-11-08 12:16 ` sashiko-bot
2026-11-10 0:32 ` Jason Gunthorpe
2026-11-11 5:01 ` Shin'ichiro Kawasaki [this message]
2026-11-11 15:37 ` Jason Gunthorpe
2026-11-12 2:13 ` Shin'ichiro Kawasaki
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=avP07JWvBtMboL8k@shinmob \
--to=shinichiro.kawasaki@wdc.com \
--cc=hch@infradead.org \
--cc=jgg@ziepe.ca \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--cc=leon@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sagi@grimberg.me \
--cc=sgogte@purestorage.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