Skip to content

Commit 7b020f1

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Report the computed connect delay
For debugging, the op_connect trace point should report the computed connect delay. We can then ensure that the delay is computed at the proper times, for example. As a further clean-up, remove a few low-value "heartbeat" trace points in the connect path. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent 6cb2868 commit 7b020f1

File tree

3 files changed

+60
-33
lines changed

3 files changed

+60
-33
lines changed

include/trace/events/rpcrdma.h

Lines changed: 56 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,44 @@ DECLARE_EVENT_CLASS(xprtrdma_rxprt,
8585
), \
8686
TP_ARGS(r_xprt))
8787

88+
DECLARE_EVENT_CLASS(xprtrdma_connect_class,
89+
TP_PROTO(
90+
const struct rpcrdma_xprt *r_xprt,
91+
int rc
92+
),
93+
94+
TP_ARGS(r_xprt, rc),
95+
96+
TP_STRUCT__entry(
97+
__field(const void *, r_xprt)
98+
__field(int, rc)
99+
__field(int, connect_status)
100+
__string(addr, rpcrdma_addrstr(r_xprt))
101+
__string(port, rpcrdma_portstr(r_xprt))
102+
),
103+
104+
TP_fast_assign(
105+
__entry->r_xprt = r_xprt;
106+
__entry->rc = rc;
107+
__entry->connect_status = r_xprt->rx_ep.rep_connected;
108+
__assign_str(addr, rpcrdma_addrstr(r_xprt));
109+
__assign_str(port, rpcrdma_portstr(r_xprt));
110+
),
111+
112+
TP_printk("peer=[%s]:%s r_xprt=%p: rc=%d connect status=%d",
113+
__get_str(addr), __get_str(port), __entry->r_xprt,
114+
__entry->rc, __entry->connect_status
115+
)
116+
);
117+
118+
#define DEFINE_CONN_EVENT(name) \
119+
DEFINE_EVENT(xprtrdma_connect_class, xprtrdma_##name, \
120+
TP_PROTO( \
121+
const struct rpcrdma_xprt *r_xprt, \
122+
int rc \
123+
), \
124+
TP_ARGS(r_xprt, rc))
125+
88126
DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
89127
TP_PROTO(
90128
const struct rpc_task *task,
@@ -333,47 +371,44 @@ TRACE_EVENT(xprtrdma_cm_event,
333371
)
334372
);
335373

336-
TRACE_EVENT(xprtrdma_disconnect,
374+
DEFINE_CONN_EVENT(connect);
375+
DEFINE_CONN_EVENT(disconnect);
376+
377+
DEFINE_RXPRT_EVENT(xprtrdma_create);
378+
DEFINE_RXPRT_EVENT(xprtrdma_op_destroy);
379+
DEFINE_RXPRT_EVENT(xprtrdma_remove);
380+
DEFINE_RXPRT_EVENT(xprtrdma_reinsert);
381+
DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc);
382+
DEFINE_RXPRT_EVENT(xprtrdma_op_close);
383+
384+
TRACE_EVENT(xprtrdma_op_connect,
337385
TP_PROTO(
338386
const struct rpcrdma_xprt *r_xprt,
339-
int status
387+
unsigned long delay
340388
),
341389

342-
TP_ARGS(r_xprt, status),
390+
TP_ARGS(r_xprt, delay),
343391

344392
TP_STRUCT__entry(
345393
__field(const void *, r_xprt)
346-
__field(int, status)
347-
__field(int, connected)
394+
__field(unsigned long, delay)
348395
__string(addr, rpcrdma_addrstr(r_xprt))
349396
__string(port, rpcrdma_portstr(r_xprt))
350397
),
351398

352399
TP_fast_assign(
353400
__entry->r_xprt = r_xprt;
354-
__entry->status = status;
355-
__entry->connected = r_xprt->rx_ep.rep_connected;
401+
__entry->delay = delay;
356402
__assign_str(addr, rpcrdma_addrstr(r_xprt));
357403
__assign_str(port, rpcrdma_portstr(r_xprt));
358404
),
359405

360-
TP_printk("peer=[%s]:%s r_xprt=%p: status=%d %sconnected",
361-
__get_str(addr), __get_str(port),
362-
__entry->r_xprt, __entry->status,
363-
__entry->connected == 1 ? "still " : "dis"
406+
TP_printk("peer=[%s]:%s r_xprt=%p delay=%lu",
407+
__get_str(addr), __get_str(port), __entry->r_xprt,
408+
__entry->delay
364409
)
365410
);
366411

367-
DEFINE_RXPRT_EVENT(xprtrdma_conn_start);
368-
DEFINE_RXPRT_EVENT(xprtrdma_conn_tout);
369-
DEFINE_RXPRT_EVENT(xprtrdma_create);
370-
DEFINE_RXPRT_EVENT(xprtrdma_op_destroy);
371-
DEFINE_RXPRT_EVENT(xprtrdma_remove);
372-
DEFINE_RXPRT_EVENT(xprtrdma_reinsert);
373-
DEFINE_RXPRT_EVENT(xprtrdma_reconnect);
374-
DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc);
375-
DEFINE_RXPRT_EVENT(xprtrdma_op_close);
376-
DEFINE_RXPRT_EVENT(xprtrdma_op_connect);
377412

378413
TRACE_EVENT(xprtrdma_op_set_cto,
379414
TP_PROTO(

net/sunrpc/xprtrdma/transport.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,13 +527,12 @@ xprt_rdma_connect(struct rpc_xprt *xprt, struct rpc_task *task)
527527
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
528528
unsigned long delay;
529529

530-
trace_xprtrdma_op_connect(r_xprt);
531-
532530
delay = 0;
533531
if (r_xprt->rx_ep.rep_connected != 0) {
534532
delay = xprt_reconnect_delay(xprt);
535533
xprt_reconnect_backoff(xprt, RPCRDMA_INIT_REEST_TO);
536534
}
535+
trace_xprtrdma_op_connect(r_xprt, delay);
537536
queue_delayed_work(xprtiod_workqueue, &r_xprt->rx_connect_worker,
538537
delay);
539538
}

net/sunrpc/xprtrdma/verbs.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,6 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
297297
struct rdma_cm_id *id;
298298
int rc;
299299

300-
trace_xprtrdma_conn_start(xprt);
301-
302300
init_completion(&ia->ri_done);
303301
init_completion(&ia->ri_remove_done);
304302

@@ -314,10 +312,8 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
314312
if (rc)
315313
goto out;
316314
rc = wait_for_completion_interruptible_timeout(&ia->ri_done, wtimeout);
317-
if (rc < 0) {
318-
trace_xprtrdma_conn_tout(xprt);
315+
if (rc < 0)
319316
goto out;
320-
}
321317

322318
rc = ia->ri_async_rc;
323319
if (rc)
@@ -328,10 +324,8 @@ rpcrdma_create_id(struct rpcrdma_xprt *xprt, struct rpcrdma_ia *ia)
328324
if (rc)
329325
goto out;
330326
rc = wait_for_completion_interruptible_timeout(&ia->ri_done, wtimeout);
331-
if (rc < 0) {
332-
trace_xprtrdma_conn_tout(xprt);
327+
if (rc < 0)
333328
goto out;
334-
}
335329
rc = ia->ri_async_rc;
336330
if (rc)
337331
goto out;
@@ -644,8 +638,6 @@ static int rpcrdma_ep_reconnect(struct rpcrdma_xprt *r_xprt,
644638
struct rdma_cm_id *id, *old;
645639
int err, rc;
646640

647-
trace_xprtrdma_reconnect(r_xprt);
648-
649641
rpcrdma_ep_disconnect(&r_xprt->rx_ep, ia);
650642

651643
rc = -EHOSTUNREACH;
@@ -744,6 +736,7 @@ rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
744736
ep->rep_connected = rc;
745737

746738
out_noupdate:
739+
trace_xprtrdma_connect(r_xprt, rc);
747740
return rc;
748741
}
749742

0 commit comments

Comments
 (0)