Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhenwen Liang <zhenwenliang@google.com>
To: Allison Henderson <achender@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org,  linux-rdma@vger.kernel.org,
	rds-devel@oss.oracle.com
Subject: [PATCH net] net/rds: use wq_has_sleeper() in rds_transition_frwr_state()
Date: Mon, 30 Nov 2026 16:47:29 +0000	[thread overview]
Message-ID: <20261130164729.981519-1-zhenwenliang@google.com> (raw)

rds_transition_frwr_state() decrements i_fastreg_inuse_count with
atomic_dec() and then checks waitqueue_active(). Nothing orders the
decrement before the wait queue load, so on arm64 or powerpc
rds_ib_conn_path_shutdown() can miss the wakeup and sleep until its
1 s timeout. Use wq_has_sleeper(), which adds the missing full barrier.

Allison Henderson pointed out that the sashiko review of a similar fix
flagged this site. The analysis was checked, and this patch prepared,
with the help of a formal analysis tool we are developing that uses AI
assistance; I have reviewed the analysis and the patch.

Fixes: 3a2886cca703 ("net/rds: Keep track of and wait for FRWR segments in use upon shutdown")
Suggested-by: Allison Henderson <achender@kernel.org>
Signed-off-by: Zhenwen Liang <zhenwenliang@google.com>
---
Compile-tested only (arm64).
Allison's comment: https://lore.kernel.org/r/604973ba164734511b6d50e61451032d5a27489a.camel@kernel.org/

 net/rds/ib_frmr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c
index 8397aa4a17ac..9a9424a499a3 100644
--- a/net/rds/ib_frmr.c
+++ b/net/rds/ib_frmr.c
@@ -45,7 +45,7 @@ rds_transition_frwr_state(struct rds_ib_mr *ibmr,
 		 */
 		smp_mb__before_atomic();
 		atomic_dec(&ibmr->ic->i_fastreg_inuse_count);
-		if (waitqueue_active(&rds_ib_ring_empty_wait))
+		if (wq_has_sleeper(&rds_ib_ring_empty_wait))
 			wake_up(&rds_ib_ring_empty_wait);
 	}
 }
-- 
2.56.1.839.g22a8290db9-goog


             reply	other threads:[~2026-11-30 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 16:47 Zhenwen Liang [this message]
2026-11-30 17:04 ` [PATCH net] net/rds: use wq_has_sleeper() in rds_transition_frwr_state() sashiko-bot

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=20261130164729.981519-1-zhenwenliang@google.com \
    --to=zhenwenliang@google.com \
    --cc=achender@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rds-devel@oss.oracle.com \
    --cc=willemb@google.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