SUNRPC: Move trace_svc_xprt_enqueue
authorChuck Lever <chuck.lever@oracle.com>
Wed, 19 Jul 2023 19:24:42 +0000 (15:24 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 29 Aug 2023 21:45:22 +0000 (17:45 -0400)
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>
include/trace/events/sunrpc.h
net/sunrpc/svc_xprt.c

index 55716b6..6beb38c 100644 (file)
@@ -2014,25 +2014,25 @@ TRACE_EVENT(svc_xprt_create_err,
 TRACE_EVENT(svc_xprt_enqueue,
        TP_PROTO(
                const struct svc_xprt *xprt,
-               const struct svc_rqst *rqst
+               unsigned long flags
        ),
 
-       TP_ARGS(xprt, rqst),
+       TP_ARGS(xprt, flags),
 
        TP_STRUCT__entry(
                SVC_XPRT_ENDPOINT_FIELDS(xprt)
-
-               __field(int, pid)
        ),
 
        TP_fast_assign(
-               SVC_XPRT_ENDPOINT_ASSIGNMENTS(xprt);
-
-               __entry->pid = rqst? rqst->rq_task->pid : 0;
+               __assign_sockaddr(server, &xprt->xpt_local,
+                                 xprt->xpt_locallen);
+               __assign_sockaddr(client, &xprt->xpt_remote,
+                                 xprt->xpt_remotelen);
+               __entry->flags = flags;
+               __entry->netns_ino = xprt->xpt_net->ns.inum;
        ),
 
-       TP_printk(SVC_XPRT_ENDPOINT_FORMAT " pid=%d",
-               SVC_XPRT_ENDPOINT_VARARGS, __entry->pid)
+       TP_printk(SVC_XPRT_ENDPOINT_FORMAT, SVC_XPRT_ENDPOINT_VARARGS)
 );
 
 TRACE_EVENT(svc_xprt_dequeue,
index 9bdcdd8..cdea4b4 100644 (file)
@@ -434,6 +434,7 @@ static bool svc_xprt_ready(struct svc_xprt *xprt)
        smp_rmb();
        xpt_flags = READ_ONCE(xprt->xpt_flags);
 
+       trace_svc_xprt_enqueue(xprt, xpt_flags);
        if (xpt_flags & BIT(XPT_BUSY))
                return false;
        if (xpt_flags & (BIT(XPT_CONN) | BIT(XPT_CLOSE) | BIT(XPT_HANDSHAKE)))
@@ -490,7 +491,6 @@ void svc_xprt_enqueue(struct svc_xprt *xprt)
        rqstp = NULL;
 out_unlock:
        rcu_read_unlock();
-       trace_svc_xprt_enqueue(xprt, rqstp);
 }
 EXPORT_SYMBOL_GPL(svc_xprt_enqueue);