Commit 82e5d82a authored by Chuck Lever's avatar Chuck Lever
Browse files

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: default avatarChuck Lever <chuck.lever@oracle.com>
parent 78c542f9
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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);