2012-01-21 03:52:23 +08:00
|
|
|
#undef TRACE_SYSTEM
|
|
|
|
#define TRACE_SYSTEM sunrpc
|
|
|
|
|
|
|
|
#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
|
|
#define _TRACE_SUNRPC_H
|
|
|
|
|
|
|
|
#include <linux/sunrpc/sched.h>
|
|
|
|
#include <linux/sunrpc/clnt.h>
|
2013-09-05 00:16:23 +08:00
|
|
|
#include <net/tcp_states.h>
|
|
|
|
#include <linux/net.h>
|
2012-01-21 03:52:23 +08:00
|
|
|
#include <linux/tracepoint.h>
|
|
|
|
|
2012-02-06 23:08:08 +08:00
|
|
|
DECLARE_EVENT_CLASS(rpc_task_status,
|
|
|
|
|
|
|
|
TP_PROTO(struct rpc_task *task),
|
|
|
|
|
|
|
|
TP_ARGS(task),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
2013-09-05 10:09:50 +08:00
|
|
|
__field(unsigned int, task_id)
|
|
|
|
__field(unsigned int, client_id)
|
2012-02-06 23:08:08 +08:00
|
|
|
__field(int, status)
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
2013-09-05 10:09:50 +08:00
|
|
|
__entry->task_id = task->tk_pid;
|
|
|
|
__entry->client_id = task->tk_client->cl_clid;
|
2012-02-06 23:08:08 +08:00
|
|
|
__entry->status = task->tk_status;
|
|
|
|
),
|
|
|
|
|
2013-09-05 10:09:50 +08:00
|
|
|
TP_printk("task:%u@%u, status %d",
|
|
|
|
__entry->task_id, __entry->client_id,
|
|
|
|
__entry->status)
|
2012-02-06 23:08:08 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_status, rpc_call_status,
|
|
|
|
TP_PROTO(struct rpc_task *task),
|
|
|
|
|
|
|
|
TP_ARGS(task)
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_status, rpc_bind_status,
|
|
|
|
TP_PROTO(struct rpc_task *task),
|
|
|
|
|
|
|
|
TP_ARGS(task)
|
|
|
|
);
|
|
|
|
|
|
|
|
TRACE_EVENT(rpc_connect_status,
|
|
|
|
TP_PROTO(struct rpc_task *task, int status),
|
|
|
|
|
|
|
|
TP_ARGS(task, status),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
2013-09-05 10:09:50 +08:00
|
|
|
__field(unsigned int, task_id)
|
|
|
|
__field(unsigned int, client_id)
|
2012-02-06 23:08:08 +08:00
|
|
|
__field(int, status)
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
2013-09-05 10:09:50 +08:00
|
|
|
__entry->task_id = task->tk_pid;
|
|
|
|
__entry->client_id = task->tk_client->cl_clid;
|
2012-02-06 23:08:08 +08:00
|
|
|
__entry->status = status;
|
|
|
|
),
|
|
|
|
|
2013-09-05 10:09:50 +08:00
|
|
|
TP_printk("task:%u@%u, status %d",
|
|
|
|
__entry->task_id, __entry->client_id,
|
|
|
|
__entry->status)
|
2012-02-06 23:08:08 +08:00
|
|
|
);
|
|
|
|
|
2012-01-21 03:52:23 +08:00
|
|
|
DECLARE_EVENT_CLASS(rpc_task_running,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, action),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
2013-09-05 10:09:50 +08:00
|
|
|
__field(unsigned int, task_id)
|
|
|
|
__field(unsigned int, client_id)
|
2012-01-21 03:52:23 +08:00
|
|
|
__field(const void *, action)
|
|
|
|
__field(unsigned long, runstate)
|
|
|
|
__field(int, status)
|
|
|
|
__field(unsigned short, flags)
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
2014-03-07 13:27:57 +08:00
|
|
|
__entry->client_id = clnt ? clnt->cl_clid : -1;
|
2013-09-05 10:09:50 +08:00
|
|
|
__entry->task_id = task->tk_pid;
|
2012-01-21 03:52:23 +08:00
|
|
|
__entry->action = action;
|
|
|
|
__entry->runstate = task->tk_runstate;
|
|
|
|
__entry->status = task->tk_status;
|
|
|
|
__entry->flags = task->tk_flags;
|
|
|
|
),
|
|
|
|
|
2014-03-07 13:27:57 +08:00
|
|
|
TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
|
2013-09-05 10:09:50 +08:00
|
|
|
__entry->task_id, __entry->client_id,
|
2012-01-21 03:52:23 +08:00
|
|
|
__entry->flags,
|
|
|
|
__entry->runstate,
|
|
|
|
__entry->status,
|
|
|
|
__entry->action
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_running, rpc_task_begin,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, action)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, action)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_running, rpc_task_complete,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, action)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
DECLARE_EVENT_CLASS(rpc_task_queued,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, q),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
2013-09-05 10:09:50 +08:00
|
|
|
__field(unsigned int, task_id)
|
|
|
|
__field(unsigned int, client_id)
|
2012-01-21 03:52:23 +08:00
|
|
|
__field(unsigned long, timeout)
|
|
|
|
__field(unsigned long, runstate)
|
|
|
|
__field(int, status)
|
|
|
|
__field(unsigned short, flags)
|
2012-02-06 23:31:35 +08:00
|
|
|
__string(q_name, rpc_qname(q))
|
2012-01-21 03:52:23 +08:00
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
2013-09-05 10:09:50 +08:00
|
|
|
__entry->client_id = clnt->cl_clid;
|
|
|
|
__entry->task_id = task->tk_pid;
|
2012-01-21 03:52:23 +08:00
|
|
|
__entry->timeout = task->tk_timeout;
|
|
|
|
__entry->runstate = task->tk_runstate;
|
|
|
|
__entry->status = task->tk_status;
|
|
|
|
__entry->flags = task->tk_flags;
|
2012-02-06 23:31:35 +08:00
|
|
|
__assign_str(q_name, rpc_qname(q));
|
2012-01-21 03:52:23 +08:00
|
|
|
),
|
|
|
|
|
2013-09-05 10:09:50 +08:00
|
|
|
TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
|
|
|
|
__entry->task_id, __entry->client_id,
|
2012-01-21 03:52:23 +08:00
|
|
|
__entry->flags,
|
|
|
|
__entry->runstate,
|
|
|
|
__entry->status,
|
|
|
|
__entry->timeout,
|
2012-02-06 23:31:35 +08:00
|
|
|
__get_str(q_name)
|
2012-01-21 03:52:23 +08:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, q)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
|
|
|
|
|
|
|
|
TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
|
|
|
|
|
|
|
|
TP_ARGS(clnt, task, q)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
2013-09-05 00:16:23 +08:00
|
|
|
#define rpc_show_socket_state(state) \
|
|
|
|
__print_symbolic(state, \
|
|
|
|
{ SS_FREE, "FREE" }, \
|
|
|
|
{ SS_UNCONNECTED, "UNCONNECTED" }, \
|
|
|
|
{ SS_CONNECTING, "CONNECTING," }, \
|
|
|
|
{ SS_CONNECTED, "CONNECTED," }, \
|
|
|
|
{ SS_DISCONNECTING, "DISCONNECTING" })
|
|
|
|
|
|
|
|
#define rpc_show_sock_state(state) \
|
|
|
|
__print_symbolic(state, \
|
|
|
|
{ TCP_ESTABLISHED, "ESTABLISHED" }, \
|
|
|
|
{ TCP_SYN_SENT, "SYN_SENT" }, \
|
|
|
|
{ TCP_SYN_RECV, "SYN_RECV" }, \
|
|
|
|
{ TCP_FIN_WAIT1, "FIN_WAIT1" }, \
|
|
|
|
{ TCP_FIN_WAIT2, "FIN_WAIT2" }, \
|
|
|
|
{ TCP_TIME_WAIT, "TIME_WAIT" }, \
|
|
|
|
{ TCP_CLOSE, "CLOSE" }, \
|
|
|
|
{ TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \
|
|
|
|
{ TCP_LAST_ACK, "LAST_ACK" }, \
|
|
|
|
{ TCP_LISTEN, "LISTEN" }, \
|
|
|
|
{ TCP_CLOSING, "CLOSING" })
|
|
|
|
|
|
|
|
DECLARE_EVENT_CLASS(xs_socket_event,
|
|
|
|
|
|
|
|
TP_PROTO(
|
|
|
|
struct rpc_xprt *xprt,
|
|
|
|
struct socket *socket
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_ARGS(xprt, socket),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(unsigned int, socket_state)
|
|
|
|
__field(unsigned int, sock_state)
|
|
|
|
__field(unsigned long long, ino)
|
|
|
|
__string(dstaddr,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_ADDR])
|
|
|
|
__string(dstport,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_PORT])
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
struct inode *inode = SOCK_INODE(socket);
|
|
|
|
__entry->socket_state = socket->state;
|
|
|
|
__entry->sock_state = socket->sk->sk_state;
|
|
|
|
__entry->ino = (unsigned long long)inode->i_ino;
|
|
|
|
__assign_str(dstaddr,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_ADDR]);
|
|
|
|
__assign_str(dstport,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_PORT]);
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_printk(
|
|
|
|
"socket:[%llu] dstaddr=%s/%s "
|
|
|
|
"state=%u (%s) sk_state=%u (%s)",
|
|
|
|
__entry->ino, __get_str(dstaddr), __get_str(dstport),
|
|
|
|
__entry->socket_state,
|
|
|
|
rpc_show_socket_state(__entry->socket_state),
|
|
|
|
__entry->sock_state,
|
|
|
|
rpc_show_sock_state(__entry->sock_state)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
#define DEFINE_RPC_SOCKET_EVENT(name) \
|
|
|
|
DEFINE_EVENT(xs_socket_event, name, \
|
|
|
|
TP_PROTO( \
|
|
|
|
struct rpc_xprt *xprt, \
|
|
|
|
struct socket *socket \
|
|
|
|
), \
|
|
|
|
TP_ARGS(xprt, socket))
|
|
|
|
|
|
|
|
DECLARE_EVENT_CLASS(xs_socket_event_done,
|
|
|
|
|
|
|
|
TP_PROTO(
|
|
|
|
struct rpc_xprt *xprt,
|
|
|
|
struct socket *socket,
|
|
|
|
int error
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_ARGS(xprt, socket, error),
|
|
|
|
|
|
|
|
TP_STRUCT__entry(
|
|
|
|
__field(int, error)
|
|
|
|
__field(unsigned int, socket_state)
|
|
|
|
__field(unsigned int, sock_state)
|
|
|
|
__field(unsigned long long, ino)
|
|
|
|
__string(dstaddr,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_ADDR])
|
|
|
|
__string(dstport,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_PORT])
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_fast_assign(
|
|
|
|
struct inode *inode = SOCK_INODE(socket);
|
|
|
|
__entry->socket_state = socket->state;
|
|
|
|
__entry->sock_state = socket->sk->sk_state;
|
|
|
|
__entry->ino = (unsigned long long)inode->i_ino;
|
|
|
|
__entry->error = error;
|
|
|
|
__assign_str(dstaddr,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_ADDR]);
|
|
|
|
__assign_str(dstport,
|
|
|
|
xprt->address_strings[RPC_DISPLAY_PORT]);
|
|
|
|
),
|
|
|
|
|
|
|
|
TP_printk(
|
|
|
|
"error=%d socket:[%llu] dstaddr=%s/%s "
|
|
|
|
"state=%u (%s) sk_state=%u (%s)",
|
|
|
|
__entry->error,
|
|
|
|
__entry->ino, __get_str(dstaddr), __get_str(dstport),
|
|
|
|
__entry->socket_state,
|
|
|
|
rpc_show_socket_state(__entry->socket_state),
|
|
|
|
__entry->sock_state,
|
|
|
|
rpc_show_sock_state(__entry->sock_state)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
|
|
|
|
DEFINE_EVENT(xs_socket_event_done, name, \
|
|
|
|
TP_PROTO( \
|
|
|
|
struct rpc_xprt *xprt, \
|
|
|
|
struct socket *socket, \
|
|
|
|
int error \
|
|
|
|
), \
|
|
|
|
TP_ARGS(xprt, socket, error))
|
|
|
|
|
|
|
|
DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
|
|
|
|
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
|
2014-01-01 02:39:22 +08:00
|
|
|
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
|
2013-09-05 00:16:23 +08:00
|
|
|
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
|
|
|
|
DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
|
|
|
|
DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
|
|
|
|
|
2012-01-21 03:52:23 +08:00
|
|
|
#endif /* _TRACE_SUNRPC_H */
|
|
|
|
|
|
|
|
#include <trace/define_trace.h>
|