Skip to content

Commit 82e5d82

Browse files
committed
SUNRPC: Move trace_svc_xprt_enqueue
The xpt_flags field frequently changes between the time that svc_xprt_ready() grabs a copy and execution flow arrives at the tracepoint at the tail of svc_xprt_enqueue(). In fact, there's usually a sleep/wake-up in there, so those flags are almost guaranteed to be different. It would be more useful to record the exact flags that were used to decide whether the transport is ready, so move the tracepoint. Moving it means the tracepoint can't pick up the waker's pid. That can be added to struct svc_rqst if it turns out that is important. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 78c542f commit 82e5d82

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

include/trace/events/sunrpc.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,25 +2014,25 @@ TRACE_EVENT(svc_xprt_create_err,
20142014
TRACE_EVENT(svc_xprt_enqueue,
20152015
TP_PROTO(
20162016
const struct svc_xprt *xprt,
2017-
const struct svc_rqst *rqst
2017+
unsigned long flags
20182018
),
20192019

2020-
TP_ARGS(xprt, rqst),
2020+
TP_ARGS(xprt, flags),
20212021

20222022
TP_STRUCT__entry(
20232023
SVC_XPRT_ENDPOINT_FIELDS(xprt)
2024-
2025-
__field(int, pid)
20262024
),
20272025

20282026
TP_fast_assign(
2029-
SVC_XPRT_ENDPOINT_ASSIGNMENTS(xprt);
2030-
2031-
__entry->pid = rqst? rqst->rq_task->pid : 0;
2027+
__assign_sockaddr(server, &xprt->xpt_local,
2028+
xprt->xpt_locallen);
2029+
__assign_sockaddr(client, &xprt->xpt_remote,
2030+
xprt->xpt_remotelen);
2031+
__entry->flags = flags;
2032+
__entry->netns_ino = xprt->xpt_net->ns.inum;
20322033
),
20332034

2034-
TP_printk(SVC_XPRT_ENDPOINT_FORMAT " pid=%d",
2035-
SVC_XPRT_ENDPOINT_VARARGS, __entry->pid)
2035+
TP_printk(SVC_XPRT_ENDPOINT_FORMAT, SVC_XPRT_ENDPOINT_VARARGS)
20362036
);
20372037

20382038
TRACE_EVENT(svc_xprt_dequeue,

net/sunrpc/svc_xprt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ static bool svc_xprt_ready(struct svc_xprt *xprt)
434434
smp_rmb();
435435
xpt_flags = READ_ONCE(xprt->xpt_flags);
436436

437+
trace_svc_xprt_enqueue(xprt, xpt_flags);
437438
if (xpt_flags & BIT(XPT_BUSY))
438439
return false;
439440
if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE) | BIT(XPT_HANDSHAKE)))
@@ -490,7 +491,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt)
490491
rqstp = NULL;
491492
out_unlock:
492493
rcu_read_unlock();
493-
trace_svc_xprt_enqueue(xprt, rqstp);
494494
}
495495
EXPORT_SYMBOL_GPL(svc_xprt_enqueue);
496496

0 commit comments

Comments
 (0)