Skip to content

Commit 0963187

Browse files
Hakon-Buggegerd-rausch
authored andcommitted
Revert "Revert "net/rds: Revert "RDS: add reconnect retry scheme for stalled"
This reverts commit fde8284 ("Revert "net/rds: Revert "RDS: add reconnect retry scheme for stalled connections"""). Here is the commit message for the first revert: <quote> Commit 5431260 ("RDS: add reconnect retry scheme for stalled connections") introduces the rds_reconnect_timeout to retry the connection establishment after sysctl_reconnect_retry_ms (default is 1000ms). Nevertheless, this proactive mechanism is overkilled and it is causing long brownout time in the virtualized environment. In short, below are the justifications why said commit is reverted. a) The retry counter starts ticking after RDS received an ADDR_CHANGE event. After receiving an ADDR_CHANGE event, RDS needs to perform shutdown via shutdown_worker. Then, initiate a new connection via connect_worker. Eventually, a CM REQ is only sent out after RDS received RDMA_CM_EVENT_ADDR_RESOLVED and RDMA_CM_EVENT_ROUTE_RESOLVED events. If the retry is made to cater for stalled connection due to missing CM messages, the retry should only happen after a CM REQ is sent. With the current retry scheme (and with the default 1000 ms) that happens after ADDR_CHANGE event, it introduces congestion in the single threaded workqueue. b) Assuming that we modify the retry counter to start ticking after a CM REQ message is sent out. By introducing another retry timeout, it complicates the system tuning. Why? First, the sysctl_reconnect_retry_ms relies on the underlying cma_response_timeout. Any modication of cma_response_timeout requires to tune sysctl_reconnect_retry_ms. Second, it is hard to find a universal timing that fits all configurations (bare-metal, virtualized, mixed environment, and homo/heterogenous system). </quote> Conflicts: net/rds/ib_cm.c net/rds/rdma_transport.c net/rds/threads.c Fixed checkpatch warnings. Orabug: 25521901 Signed-off-by: Håkon Bugge <[email protected]> Reviewed-by: Shannon Nelson <[email protected]>
1 parent aab0951 commit 0963187

File tree

7 files changed

+28
-81
lines changed

7 files changed

+28
-81
lines changed

net/rds/connection.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,6 @@ static struct rds_connection *__rds_conn_create(struct net *net,
268268

269269
__rds_conn_path_init(conn, cp, is_outgoing);
270270
cp->cp_index = i;
271-
cp->cp_reconnect_retry = rds_sysctl_reconnect_retry_ms;
272-
cp->cp_reconnect_retry_count = 0;
273-
274271
if (conn->c_loopback)
275272
cp->cp_wq = rds_local_wq;
276273
else

net/rds/ib_cm.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,23 +1091,20 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
10911091
rds_ib_stats_inc(s_ib_listen_closed_stale);
10921092
} else if (rds_conn_state(conn) == RDS_CONN_CONNECTING) {
10931093
unsigned long now = get_seconds();
1094-
unsigned long retry = conn->c_reconnect_retry;
10951094

1096-
1097-
/* after retry seconds, give up on
1098-
* existing connection attempts and try again.
1099-
* At this point it's no longer backoff race but
1100-
* something has gone horribly wrong.
1095+
/* After 15 seconds, give up on existing connection
1096+
* attempts and make them try again. At this point
1097+
* it's no longer a race but something has gone
1098+
* horribly wrong
11011099
*/
1102-
retry = DIV_ROUND_UP(retry, 1000);
11031100
if (now > conn->c_connection_start &&
1104-
now - conn->c_connection_start > retry) {
1105-
pr_info("RDS/IB: conn <%pI6c,%pI6c,%d> racing for more than %lus, retry\n",
1106-
&conn->c_laddr, &conn->c_faddr,
1107-
conn->c_tos, retry);
1108-
set_bit(RDS_RECONNECT_TIMEDOUT,
1109-
&conn->c_reconn_flags);
1110-
rds_conn_drop(conn, DR_RECONNECT_TIMEOUT);
1101+
now - conn->c_connection_start > 15) {
1102+
rds_rtd_ptr(RDS_RTD_CM,
1103+
"RDS/IB: connection <%pI6c,%pI6c,%d> racing for 15s, forcing reset",
1104+
&conn->c_laddr,
1105+
&conn->c_faddr,
1106+
conn->c_tos);
1107+
rds_conn_drop(conn, DR_IB_REQ_WHILE_CONNECTING);
11111108
rds_ib_stats_inc(s_ib_listen_closed_stale);
11121109
} else {
11131110
/* Wait and see - our connect may still be succeeding */

net/rds/rdma_transport.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,8 @@ int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id,
276276
"ADDR_CHANGE: calling rds_conn_drop <%pI6c,%pI6c,%d>\n",
277277
&conn->c_laddr, &conn->c_faddr,
278278
conn->c_tos);
279-
if (!rds_conn_self_loopback_passive(conn)) {
280-
queue_delayed_work(conn->c_path[0].cp_wq,
281-
&conn->c_reconn_w,
282-
msecs_to_jiffies(conn->c_reconnect_retry));
279+
if (!rds_conn_self_loopback_passive(conn))
283280
rds_conn_drop(conn, DR_IB_ADDR_CHANGE);
284-
}
285281
}
286282
break;
287283

net/rds/rds.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ enum {
150150
#define RDS_MPATH_WORKERS 8
151151
#define RDS_MPATH_HASH(rs, n) (jhash_1word((rs)->rs_bound_port, \
152152
(rs)->rs_hash_initval) & ((n) - 1))
153-
/* Bits for c_reconn_flags */
154-
#define RDS_RECONNECT_TIMEDOUT 0
155153
enum rds_conn_drop_src {
156154
/* rds-core */
157155
DR_DEFAULT,
@@ -304,6 +302,15 @@ struct rds_connection {
304302
unsigned int c_version;
305303
struct net *c_net;
306304

305+
/* Re-connect stall diagnostics */
306+
unsigned long c_reconnect_start;
307+
unsigned int c_reconnect_drops;
308+
int c_reconnect_warn;
309+
int c_reconnect_err;
310+
int c_to_index;
311+
312+
unsigned int c_reconnect;
313+
307314
/* Qos support */
308315
u8 c_tos;
309316

@@ -1124,8 +1131,6 @@ extern unsigned long rds_sysctl_trace_flags;
11241131
extern unsigned int rds_sysctl_trace_level;
11251132
extern unsigned int rds_sysctl_shutdown_trace_start_time;
11261133
extern unsigned int rds_sysctl_shutdown_trace_end_time;
1127-
extern unsigned long rds_sysctl_reconnect_retry_ms;
1128-
extern unsigned int rds_sysctl_reconnect_max_retries;
11291134

11301135
/* threads.c */
11311136
int rds_threads_init(void);

net/rds/rds_single_path.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#define c_send_w c_path[0].cp_send_w
2222
#define c_recv_w c_path[0].cp_recv_w
2323
#define c_conn_w c_path[0].cp_conn_w
24-
#define c_reconn_w c_path[0].cp_reconn_w
2524
#define c_down_w c_path[0].cp_down_w
2625
#define c_cm_lock c_path[0].cp_cm_lock
2726
#define c_waitq c_path[0].cp_waitq
@@ -32,8 +31,6 @@
3231
#define c_acl_init c_path[0].cp_acl_init
3332
#define c_connection_start c_path[0].cp_connection_start
3433
#define c_reconnect_racing c_path[0].cp_reconnect_racing
35-
#define c_reconnect_retry c_path[0].cp_reconnect_retry
36-
#define c_reconn_flags c_path[0].cp_reconn_flags
3734
#define c_reconnect c_path[0].cp_reconnect
3835
#define c_to_index c_path[0].cp_to_index
3936
#define c_acl_en c_path[0].cp_acl_en

net/rds/sysctl.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ unsigned int rds_sysctl_ping_enable = 1;
5252
unsigned int rds_sysctl_shutdown_trace_start_time;
5353
unsigned int rds_sysctl_shutdown_trace_end_time;
5454

55-
unsigned long rds_sysctl_reconnect_retry_ms = 1000;
56-
static unsigned long reconnect_retry_ms_min = 100;
57-
static unsigned long reconnect_retry_ms_max = 15000;
58-
59-
unsigned int rds_sysctl_reconnect_max_retries = 60;
60-
static unsigned long reconnect_min_retries = 15;
61-
6255
/*
6356
* We have official values, but must maintain the sysctl interface for existing
6457
* software that expects to find these values here.
@@ -133,25 +126,6 @@ static struct ctl_table rds_sysctl_rds_table[] = {
133126
.maxlen = sizeof(int),
134127
.mode = 0644,
135128
.proc_handler = &proc_dointvec,
136-
137-
},
138-
{
139-
.procname = "reconnect_retry_ms",
140-
.data = &rds_sysctl_reconnect_retry_ms,
141-
.maxlen = sizeof(unsigned long),
142-
.mode = 0644,
143-
.proc_handler = proc_dointvec_minmax,
144-
.extra1 = &reconnect_retry_ms_min,
145-
.extra2 = &reconnect_retry_ms_max,
146-
},
147-
{
148-
.procname = "reconnect_max_retries",
149-
.data = &rds_sysctl_reconnect_max_retries,
150-
.maxlen = sizeof(unsigned int),
151-
.mode = 0644,
152-
.proc_handler = proc_dointvec_minmax,
153-
.extra1 = &reconnect_min_retries,
154-
.extra2 = &rds_sysctl_reconnect_max_retries,
155129
},
156130
{ }
157131
};

net/rds/threads.c

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ void rds_connect_path_complete(struct rds_conn_path *cp, int curr)
9494
conn, &conn->c_laddr, &conn->c_faddr, conn->c_tos);
9595

9696
cp->cp_reconnect_jiffies = 0;
97-
cp->cp_reconnect_retry = rds_sysctl_reconnect_retry_ms;
98-
cp->cp_reconnect_retry_count = 0;
9997
set_bit(0, &conn->c_map_queued);
10098
queue_delayed_work(cp->cp_wq, &cp->cp_send_w, 0);
10199
queue_delayed_work(cp->cp_wq, &cp->cp_recv_w, 0);
@@ -148,8 +146,7 @@ void rds_queue_reconnect(struct rds_conn_path *cp)
148146
return;
149147

150148
set_bit(RDS_RECONNECT_PENDING, &cp->cp_flags);
151-
if (cp->cp_reconnect_jiffies == 0 ||
152-
test_and_clear_bit(RDS_RECONNECT_TIMEDOUT, &cp->cp_reconn_flags)) {
149+
if (cp->cp_reconnect_jiffies == 0) {
153150
cp->cp_reconnect_jiffies = rds_sysctl_reconnect_min_jiffies;
154151
queue_delayed_work(cp->cp_wq, &cp->cp_conn_w, 0);
155152
return;
@@ -306,28 +303,12 @@ void rds_reconnect_timeout(struct work_struct *work)
306303
cp_reconn_w.work);
307304
struct rds_connection *conn = cp->cp_conn;
308305

309-
if (cp->cp_reconnect_retry_count > rds_sysctl_reconnect_max_retries) {
310-
pr_info("RDS: connection <%pI6c,%pI6c,%d> reconnect retries(%d) exceeded, stop retry\n",
311-
&conn->c_laddr, &conn->c_faddr, conn->c_tos,
312-
cp->cp_reconnect_retry_count);
313-
return;
314-
}
315-
316-
if (!rds_conn_up(conn)) {
317-
if (rds_conn_state(conn) == RDS_CONN_DISCONNECTING) {
318-
queue_delayed_work(cp->cp_wq, &cp->cp_reconn_w,
319-
msecs_to_jiffies(100));
320-
} else {
321-
cp->cp_reconnect_retry_count++;
322-
rds_rtd_ptr(RDS_RTD_CM,
323-
"conn <%pI6c,%pI6c,%d> not up, retry(%d)\n",
324-
&conn->c_laddr, &conn->c_faddr, conn->c_tos,
325-
cp->cp_reconnect_retry_count);
326-
queue_delayed_work(cp->cp_wq, &cp->cp_reconn_w,
327-
msecs_to_jiffies(cp->cp_reconnect_retry));
328-
set_bit(RDS_RECONNECT_TIMEDOUT, &cp->cp_reconn_flags);
329-
rds_conn_drop(conn, DR_RECONNECT_TIMEOUT);
330-
}
306+
if (!rds_conn_path_up(cp)) {
307+
rds_rtd_ptr(RDS_RTD_CM,
308+
"conn <%pI6c,%pI6c,%d> not up, retry(%d)\n",
309+
&conn->c_laddr, &conn->c_faddr, conn->c_tos,
310+
cp->cp_reconnect_retry_count);
311+
rds_conn_path_drop(cp, DR_RECONNECT_TIMEOUT);
331312
}
332313
}
333314

0 commit comments

Comments
 (0)