From: Allison Henderson <achender@kernel.org>
To: netdev@vger.kernel.org, pabeni@redhat.com, edumazet@google.com,
kuba@kernel.org, horms@kernel.org, linux-rdma@vger.kernel.org,
achender@kernel.org, linux-kselftest@vger.kernel.org,
shuah@kernel.org
Subject: [PATCH net-next v3 01/11] net/rds: Don't sleep inside rds_ib_conn_path_shutdown
Date: Sun, 17 May 2026 18:24:33 -0700 [thread overview]
Message-ID: <20260518012443.2629206-2-achender@kernel.org> (raw)
In-Reply-To: <20260518012443.2629206-1-achender@kernel.org>
New rds rdma self tests exposed a hang when tearing down
the ib network configs. This is caused by the shutdown worker
thread sleeping on the wait_event call, which blocks other work
items in the queue. Fix this by changing wait_event to
wait_event timeout, and looping until the wait check succeeds.
Signed-off-by: Allison Henderson <achender@kernel.org>
---
net/rds/ib_cm.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 0c64c504f79db..6b40345ba44d1 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -1038,6 +1038,19 @@ int rds_ib_conn_path_connect(struct rds_conn_path *cp)
return ret;
}
+static unsigned long rds_ib_conn_path_shutdown_check_wait(struct rds_conn_path *cp)
+{
+ struct rds_connection *conn = cp->cp_conn;
+ struct rds_ib_connection *ic = conn->c_transport_data;
+
+ return (!ic->i_cm_id ||
+ (rds_ib_ring_empty(&ic->i_recv_ring) &&
+ (atomic_read(&ic->i_signaled_sends) == 0) &&
+ (atomic_read(&ic->i_fastreg_inuse_count)) == 0 &&
+ (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR))) ? 0
+ : msecs_to_jiffies(1000);
+}
+
/*
* This is so careful about only cleaning up resources that were built up
* so that it can be called at any point during startup. In fact it
@@ -1078,11 +1091,13 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
* sends to complete we're ensured that there will be no
* more tx processing.
*/
- wait_event(rds_ib_ring_empty_wait,
- rds_ib_ring_empty(&ic->i_recv_ring) &&
- (atomic_read(&ic->i_signaled_sends) == 0) &&
- (atomic_read(&ic->i_fastreg_inuse_count) == 0) &&
- (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR));
+ while (!wait_event_timeout(rds_ib_ring_empty_wait,
+ rds_ib_conn_path_shutdown_check_wait(cp) == 0,
+ msecs_to_jiffies(1000))) {
+ tasklet_schedule(&ic->i_send_tasklet);
+ tasklet_schedule(&ic->i_recv_tasklet);
+ }
+
tasklet_kill(&ic->i_send_tasklet);
tasklet_kill(&ic->i_recv_tasklet);
--
2.25.1
next prev parent reply other threads:[~2026-05-18 1:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 1:24 [PATCH net-next v3 00/11] selftests: rds: Add ROCE support to rds selftests Allison Henderson
2026-05-18 1:24 ` Allison Henderson [this message]
2026-05-18 1:24 ` [PATCH net-next v3 02/11] selftests: rds: Add helper function setup_tcp() in test.py Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 03/11] selftests: rds: Add helper function check_info() " Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 04/11] selftests: rds: Add helper function send_burst() " Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 05/11] selftests: rds: Add helper function recv_burst() " Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 06/11] selftests: rds: Add helper function verify_hashes() " Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 07/11] selftests: rds: Add helper function snd_rcv_packets() " Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 08/11] selftests: rds: Handle errors in netns_socket Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 09/11] selftests: rds: Register network teardown via atexit Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 10/11] selftests: rds: Add ROCE support to test.py Allison Henderson
2026-05-18 1:24 ` [PATCH net-next v3 11/11] selftests: rds: Add ROCE support to run.sh Allison Henderson
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=20260518012443.2629206-2-achender@kernel.org \
--to=achender@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
/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