🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16974

Re: [PATCH] RDMA/cma: add rdma_destroy_id_wq() and use it from RDS

#16974
From: Allison Henderson
Date: Mon, 16 Nov 2026 06:47
58 lines
10638 bytes
On Sat, 2026-11-14 at 20:18 -0400, Jason Gunthorpe wrote:
> On Sat, Nov 14, 2026 at 11:05:41PM +0800, Aibing Chen wrote:
> > syzbot reported a possible circular locking dependency between
> > rds_trans_sem and the RDMA CM handler mutex:
> > 
> >   CPU0 (bind path)                    CPU1 (CM callback path)
> >   ----                                ----
> >   down_read(&rds_trans_sem)           mutex_lock(&handler_mutex)
> >   rds_ib_laddr_check()                cma_ib_req_handler()
> >     rdma_destroy_id()                   rds_ib_cm_handle_connect()
> >       mutex_lock(&handler_mutex)          rds_conn_create()
> >                                             rds_trans_get_preferred()
> >                                               down_read(&rds_trans_sem)
> > 
> > rds_ib_laddr_check_cm() destroys the CM id from inside
> > rds_trans_get_preferred()'s read-side critical section, while CM
> > callbacks create RDS connections (taking the same read lock) from
> > under handler_mutex.
> > 
> > Break the cycle by destroying the CM id asynchronously: add
> > rdma_destroy_id_wq(), which queues the destruction on cma_wq, and
> > switch rds_ib_laddr_check_cm() to it.  The destroy work is embedded
> > in struct rdma_id_private, which keeps the id alive until the work
> > runs; rds does not touch cm_id after the destroy call.
> 
> This doesn't seem like it should be the core codes problem? Why can't
> rds do the workqueue?
> 
> Jason

Hi Aibing,

Aibing, thanks for chasing this down.  I think Jason is right, this
should probably be in the rds side.  This solution doesnt quite cover
all the locking issues though.  rds_conn_create calls
rds_trans_get_preferred() which falls through to rds_ib_laddr_check_cm()
when not local.  And then we get a rdma_destroy_id while the listen id's
handler_mutex is still held.

I think a better way to do this might be to create a new work item and
then deffer the rdma_destroy_id to be completed later by a worker.  The
work item would just hold the cm_id queued on rds_wq, and then the handler
just calls rdma_destroy_id() and frees itself.  alloc the new work item at
the top of rds_ib_laddr_check_cm and then queue the new work item in place of
the rdma_destroy_id.  You'll also need to add another flush_workqueue(rds_wq)
after rds_trans_unregister() in rds_ib_exit().

Other nits:  this patch should have a fixes tag, and target the net tree
like this: "[PATCH net v2] net/rds ...".  And I think the fixes tag is:
ec16227e1414 ("RDS/IB: Infiniband transport").  Drop the tested-by until it
is tested by syzbot and/or Eduard, and be sure to update your change log
below the dashed line.

Thanks for working on this!
Allion
Technical Details
Message-ID: <cee2fea9e09d50d33a9786260edbb295179fc1e9.camel@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364087-linux-kernel-netdev=dewy.ru
References: <20261114150541.1908-1-chenaibing@cmss.chinamobile.com> <20261115001851.GH2532299@ziepe.ca>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364087-linux-kernel-netdev=dewy.ru
From: achender@kernel.org (Allison Henderson)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] RDMA/cma: add rdma_destroy_id_wq() and use it from RDS
Date: Sun, 15 Nov 2026 23:47:45 -0700
Organization: Usenet Network
Message-ID: <cee2fea9e09d50d33a9786260edbb295179fc1e9.camel@kernel.org>
References: <20261114150541.1908-1-chenaibing@cmss.chinamobile.com>
	 <20261115001851.GH2532299@ziepe.ca>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="1997457"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:PxDSJvFXnA4RM2nBq88fQYDqLKQ= sha256:dKPsnhGg5dKLouJkvQ0m5Il2RWxQKvTgfG+dmIZZfA8=
	sha1:vEgduBvUlZr0GodE7GcMp4N6qec= sha256:Ji0po/0cgzxv1lkrsna/EWs1HSRkNr9A2paxyeSq/UI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6D7BE114B45; Mon, 16 Nov 2026 09:48:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id PAdmTYC9Cg-R;
	Mon, 16 Nov 2026 09:48:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364087-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id AA7BD114B2E; Mon, 16 Nov 2026 09:48:13 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id D0386326BA; Mon, 16 Nov 2026 06:47:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794811668;
	b=x1j7qW828emPZB1Ttkhw0Ay3P+H46BKtG6vL1cmNBninrIZmyoFALHtWgzvpF79v6hlP
	 RR2Pl2ZnNLZPQIPgGHBIzBkzXicLhSYGrHHqlA/S9g6oz+OkdX3/jIuKgP+6RkDAGr0Pd
	 CA4CD9U9jPANvGhi3C2Ht3efy5ajSXJpQJgbS2jnRNenlKZlJ+X4o+44zj10RcDdDY2ck
	 iyqpdn2yV43eAgAwxG0DrCZEa85DtRePuH336irXKFRqAI5y+B08yUPLTp+fUGZaCRdKi
	 FHVvs9azmBB3urJxrtLi8OmPa3SwbforXvKdCL41j+B1nMeu5UAOamixPoZRMsmFBzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794811668;
	h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Subject:
	 From:To:Cc:Date:In-Reply-To:References:Content-Type:
	 Content-Transfer-Encoding:User-Agent:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version;
	bh=HvhOTGquWWqSov5pWXvbVX0ZD7JwTIftmYtwAtViYDg=;
	b=l7sDE7c1y1vdaFisYoxDmI2gj04FDtmP25M6FdJ9wiNKFBgMwWqujP0M8DHhS+ZDEP/i
	 ziLxhT1yP7KfDKYwQnuG4CVIeuXLwp6fVTE3jqZQjzlEWjUeMi/LQLvBEVZBlQdj3cKTF
	 uSfcB5JoRpiwfCOGiawztS2W2Nwcgm4mGSgVUhA8kdXHBq2TRKmx3mAili6snFozYcthY
	 gXBPqKgvy53UZ8LkdfGDqF9+rP6aMsxu9ye5q1sYpRcudh4Iugh23zPkmFkrdEzzqsqYH
	 DwGgOBbgQY5x4LN5jPOZ3u6Ne2NR/T7PvSHAFYHVZB8R9ADdTGoHNe0gExYVPzTLiXQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="YA3/xBe4";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1F841606A330;
	Mon, 16 Nov 2026 06:47:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YA3/xBe4
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794811667;
	b=lryrLHQ/4VLXLQGlSDkDAChYDoh4qwofaZWdM81XqzjcvRkswLxldJI2X/TPwuBMkz6a
	 i3Z+92zLzvcbbIIa8tqxS2nFXdxSUDdMcox/vyTPBXfdIWthPzSI1xBz4APN+KxbexhAR
	 Uagl5ud8Ho5AAYRf2ekCBKSryncH6fP+WgXhXICBWFMVFjdg/as3qZpw8XRzMPlm219bF
	 1wGPaNioen63hYWMJXVXUTeUDyus64jd+Zlxv06wpZ+GagqANRwFyxl5fvHgZtZu4IkaU
	 rw9MUyz3vXw3y/v1+Tm1vdJGCjDmGCg+1znAQyfgRTxum/WWzpYSsO/3tw57K9RqTsA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794811667;
	h=Received:DKIM-Signature:Message-ID:Subject:From:To:Cc:Date:
	 In-Reply-To:References:Content-Type:Content-Transfer-Encoding:
	 User-Agent:MIME-Version;
	bh=HvhOTGquWWqSov5pWXvbVX0ZD7JwTIftmYtwAtViYDg=;
	b=A6wC2MoLRQ3pbiZtQU7pIyLOXnDM8KpkK/HLjrlRsiC+gaDeU0ofx8Eq97sHMtgWIndf
	 L7SYRlHXTRyuG7qysYbuXFJfy/pczkMI4LNjw18SWwlKzsLJcxVWpkFRpOI8FihmE9ejV
	 4/sTrF/AcvjeSiK/TQltqAJhZLuKE7KTD2F+9ZZYRNLNZPcmXOnEq6t1IGhdAr9SQOQ6a
	 thEs2IhkG5lTfQVDLyMsmojFFMxCXMzX45WAPTyefalKdq34tpM/+zT0kuEuhPy2CikoI
	 yRVUyUUzbMQaLruUpOq6plJ4u0TEKVtAl6n6gMwO7WTpNTQowOGTykrZeAbizg1Qncg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="YA3/xBe4";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41398606A336;
	Mon, 16 Nov 2026 06:47:47 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 422551F000C9;
	Mon, 16 Nov 2026 06:47:46 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794811666;
	bh=HvhOTGquWWqSov5pWXvbVX0ZD7JwTIftmYtwAtViYDg=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=YA3/xBe4Lj9/kfUygUC3XXgFgC9Fp8RySOpvpRRPiavvanCMy4QNyPcZ+FrI4ZzA9
	 aQaCgI5tnP3MJa0mKqY53TyHeFwcWx8J71UaCST0fNn22im6xaB2pqkddMeEMUIuow
	 XJ2XvnFf5D8y28ltSyRmU28zQM/f0aOPTkITGirBzvjdJIBLoWQCIGLLH3KnoUh4K6
	 uITV2JWsvWH2kcMxIq+XyDOzJrfrW0jvm+PmuwmZiNeoJQrlG7HylLrfgXN5OKrZFd
	 15RO+2SqoFhTI0Bwy7+u8S7dYmVaNxusiDZKa7i8M6HWGDhig70nvESGRoxTCZHxWa
	 2oAvOAV6WequA==
X-Cc: leon@kernel.org, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org,  pabeni@redhat.com, horms@kernel.org,
 linux-rdma@vger.kernel.org,  netdev@vger.kernel.org,
 rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org,  hdanton@sina.com,
 hackerowskiy@gmail.com, 
 syzbot+ccdb5058c3df2d94811c@syzkaller.appspotmail.com
X-In-Reply-To: <20261115001851.GH2532299@ziepe.ca>
X-User-Agent: Evolution 3.52.3-0ubuntu1.1 
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list