Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM sunrpc |
| 4 | |
| 5 | #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_SUNRPC_H |
| 7 | |
| 8 | #include <linux/sunrpc/sched.h> |
| 9 | #include <linux/sunrpc/clnt.h> |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 10 | #include <linux/sunrpc/svc.h> |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 11 | #include <linux/sunrpc/xprtsock.h> |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 12 | #include <linux/sunrpc/svc_xprt.h> |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 13 | #include <net/tcp_states.h> |
| 14 | #include <linux/net.h> |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 15 | #include <linux/tracepoint.h> |
| 16 | |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 17 | DECLARE_EVENT_CLASS(rpc_task_status, |
| 18 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 19 | TP_PROTO(const struct rpc_task *task), |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 20 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 21 | TP_ARGS(task), |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 22 | |
| 23 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 24 | __field(unsigned int, task_id) |
| 25 | __field(unsigned int, client_id) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 26 | __field(int, status) |
| 27 | ), |
| 28 | |
| 29 | TP_fast_assign( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 30 | __entry->task_id = task->tk_pid; |
| 31 | __entry->client_id = task->tk_client->cl_clid; |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 32 | __entry->status = task->tk_status; |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 33 | ), |
| 34 | |
Chuck Lever | 5206944 | 2018-01-03 15:38:33 -0500 | [diff] [blame] | 35 | TP_printk("task:%u@%u status=%d", |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 36 | __entry->task_id, __entry->client_id, |
| 37 | __entry->status) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 38 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 39 | #define DEFINE_RPC_STATUS_EVENT(name) \ |
| 40 | DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \ |
| 41 | TP_PROTO( \ |
| 42 | const struct rpc_task *task \ |
| 43 | ), \ |
| 44 | TP_ARGS(task)) |
| 45 | |
| 46 | DEFINE_RPC_STATUS_EVENT(call); |
| 47 | DEFINE_RPC_STATUS_EVENT(bind); |
| 48 | DEFINE_RPC_STATUS_EVENT(connect); |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 49 | |
Chuck Lever | c435da6 | 2017-11-03 13:46:14 -0400 | [diff] [blame] | 50 | TRACE_EVENT(rpc_request, |
| 51 | TP_PROTO(const struct rpc_task *task), |
| 52 | |
| 53 | TP_ARGS(task), |
| 54 | |
| 55 | TP_STRUCT__entry( |
| 56 | __field(unsigned int, task_id) |
| 57 | __field(unsigned int, client_id) |
| 58 | __field(int, version) |
| 59 | __field(bool, async) |
| 60 | __string(progname, task->tk_client->cl_program->name) |
| 61 | __string(procname, rpc_proc_name(task)) |
| 62 | ), |
| 63 | |
| 64 | TP_fast_assign( |
| 65 | __entry->task_id = task->tk_pid; |
| 66 | __entry->client_id = task->tk_client->cl_clid; |
| 67 | __entry->version = task->tk_client->cl_vers; |
| 68 | __entry->async = RPC_IS_ASYNC(task); |
| 69 | __assign_str(progname, task->tk_client->cl_program->name) |
| 70 | __assign_str(procname, rpc_proc_name(task)) |
| 71 | ), |
| 72 | |
| 73 | TP_printk("task:%u@%u %sv%d %s (%ssync)", |
| 74 | __entry->task_id, __entry->client_id, |
| 75 | __get_str(progname), __entry->version, |
| 76 | __get_str(procname), __entry->async ? "a": "" |
| 77 | ) |
| 78 | ); |
| 79 | |
Chuck Lever | 6f701383 | 2019-02-11 11:24:00 -0500 | [diff] [blame] | 80 | TRACE_DEFINE_ENUM(RPC_TASK_ASYNC); |
| 81 | TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER); |
| 82 | TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN); |
| 83 | TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS); |
| 84 | TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC); |
| 85 | TRACE_DEFINE_ENUM(RPC_TASK_KILLED); |
| 86 | TRACE_DEFINE_ENUM(RPC_TASK_SOFT); |
| 87 | TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN); |
| 88 | TRACE_DEFINE_ENUM(RPC_TASK_SENT); |
| 89 | TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT); |
| 90 | TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT); |
| 91 | TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT); |
| 92 | |
| 93 | #define rpc_show_task_flags(flags) \ |
| 94 | __print_flags(flags, "|", \ |
| 95 | { RPC_TASK_ASYNC, "ASYNC" }, \ |
| 96 | { RPC_TASK_SWAPPER, "SWAPPER" }, \ |
| 97 | { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \ |
| 98 | { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \ |
| 99 | { RPC_TASK_DYNAMIC, "DYNAMIC" }, \ |
| 100 | { RPC_TASK_KILLED, "KILLED" }, \ |
| 101 | { RPC_TASK_SOFT, "SOFT" }, \ |
| 102 | { RPC_TASK_SOFTCONN, "SOFTCONN" }, \ |
| 103 | { RPC_TASK_SENT, "SENT" }, \ |
| 104 | { RPC_TASK_TIMEOUT, "TIMEOUT" }, \ |
| 105 | { RPC_TASK_NOCONNECT, "NOCONNECT" }, \ |
| 106 | { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }) |
| 107 | |
| 108 | TRACE_DEFINE_ENUM(RPC_TASK_RUNNING); |
| 109 | TRACE_DEFINE_ENUM(RPC_TASK_QUEUED); |
| 110 | TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE); |
| 111 | TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT); |
| 112 | TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV); |
| 113 | TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT); |
| 114 | |
| 115 | #define rpc_show_runstate(flags) \ |
| 116 | __print_flags(flags, "|", \ |
| 117 | { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \ |
| 118 | { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \ |
| 119 | { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \ |
| 120 | { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \ |
| 121 | { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \ |
| 122 | { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }) |
| 123 | |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 124 | DECLARE_EVENT_CLASS(rpc_task_running, |
| 125 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 126 | TP_PROTO(const struct rpc_task *task, const void *action), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 127 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 128 | TP_ARGS(task, action), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 129 | |
| 130 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 131 | __field(unsigned int, task_id) |
| 132 | __field(unsigned int, client_id) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 133 | __field(const void *, action) |
| 134 | __field(unsigned long, runstate) |
| 135 | __field(int, status) |
| 136 | __field(unsigned short, flags) |
| 137 | ), |
| 138 | |
| 139 | TP_fast_assign( |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 140 | __entry->client_id = task->tk_client ? |
| 141 | task->tk_client->cl_clid : -1; |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 142 | __entry->task_id = task->tk_pid; |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 143 | __entry->action = action; |
| 144 | __entry->runstate = task->tk_runstate; |
| 145 | __entry->status = task->tk_status; |
| 146 | __entry->flags = task->tk_flags; |
| 147 | ), |
| 148 | |
Chuck Lever | 6f701383 | 2019-02-11 11:24:00 -0500 | [diff] [blame] | 149 | TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%pf", |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 150 | __entry->task_id, __entry->client_id, |
Chuck Lever | 6f701383 | 2019-02-11 11:24:00 -0500 | [diff] [blame] | 151 | rpc_show_task_flags(__entry->flags), |
| 152 | rpc_show_runstate(__entry->runstate), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 153 | __entry->status, |
| 154 | __entry->action |
| 155 | ) |
| 156 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 157 | #define DEFINE_RPC_RUNNING_EVENT(name) \ |
| 158 | DEFINE_EVENT(rpc_task_running, rpc_task_##name, \ |
| 159 | TP_PROTO( \ |
| 160 | const struct rpc_task *task, \ |
| 161 | const void *action \ |
| 162 | ), \ |
| 163 | TP_ARGS(task, action)) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 164 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 165 | DEFINE_RPC_RUNNING_EVENT(begin); |
| 166 | DEFINE_RPC_RUNNING_EVENT(run_action); |
| 167 | DEFINE_RPC_RUNNING_EVENT(complete); |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 168 | |
| 169 | DECLARE_EVENT_CLASS(rpc_task_queued, |
| 170 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 171 | TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 172 | |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 173 | TP_ARGS(task, q), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 174 | |
| 175 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 176 | __field(unsigned int, task_id) |
| 177 | __field(unsigned int, client_id) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 178 | __field(unsigned long, timeout) |
| 179 | __field(unsigned long, runstate) |
| 180 | __field(int, status) |
| 181 | __field(unsigned short, flags) |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 182 | __string(q_name, rpc_qname(q)) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 183 | ), |
| 184 | |
| 185 | TP_fast_assign( |
Chuck Lever | e671edb | 2018-03-16 10:33:44 -0400 | [diff] [blame] | 186 | __entry->client_id = task->tk_client ? |
| 187 | task->tk_client->cl_clid : -1; |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 188 | __entry->task_id = task->tk_pid; |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 189 | __entry->timeout = task->tk_timeout; |
| 190 | __entry->runstate = task->tk_runstate; |
| 191 | __entry->status = task->tk_status; |
| 192 | __entry->flags = task->tk_flags; |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 193 | __assign_str(q_name, rpc_qname(q)); |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 194 | ), |
| 195 | |
Chuck Lever | 6f701383 | 2019-02-11 11:24:00 -0500 | [diff] [blame] | 196 | TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s", |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 197 | __entry->task_id, __entry->client_id, |
Chuck Lever | 6f701383 | 2019-02-11 11:24:00 -0500 | [diff] [blame] | 198 | rpc_show_task_flags(__entry->flags), |
| 199 | rpc_show_runstate(__entry->runstate), |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 200 | __entry->status, |
| 201 | __entry->timeout, |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 202 | __get_str(q_name) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 203 | ) |
| 204 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 205 | #define DEFINE_RPC_QUEUED_EVENT(name) \ |
| 206 | DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \ |
| 207 | TP_PROTO( \ |
| 208 | const struct rpc_task *task, \ |
| 209 | const struct rpc_wait_queue *q \ |
| 210 | ), \ |
| 211 | TP_ARGS(task, q)) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 212 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 213 | DEFINE_RPC_QUEUED_EVENT(sleep); |
| 214 | DEFINE_RPC_QUEUED_EVENT(wakeup); |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 215 | |
Chuck Lever | e8680a2 | 2019-02-11 11:24:48 -0500 | [diff] [blame^] | 216 | DECLARE_EVENT_CLASS(rpc_failure, |
| 217 | |
| 218 | TP_PROTO(const struct rpc_task *task), |
| 219 | |
| 220 | TP_ARGS(task), |
| 221 | |
| 222 | TP_STRUCT__entry( |
| 223 | __field(unsigned int, task_id) |
| 224 | __field(unsigned int, client_id) |
| 225 | ), |
| 226 | |
| 227 | TP_fast_assign( |
| 228 | __entry->task_id = task->tk_pid; |
| 229 | __entry->client_id = task->tk_client->cl_clid; |
| 230 | ), |
| 231 | |
| 232 | TP_printk("task:%u@%u", |
| 233 | __entry->task_id, __entry->client_id) |
| 234 | ); |
| 235 | |
| 236 | #define DEFINE_RPC_FAILURE(name) \ |
| 237 | DEFINE_EVENT(rpc_failure, rpc_bad_##name, \ |
| 238 | TP_PROTO( \ |
| 239 | const struct rpc_task *task \ |
| 240 | ), \ |
| 241 | TP_ARGS(task)) |
| 242 | |
| 243 | DEFINE_RPC_FAILURE(callhdr); |
| 244 | |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 245 | TRACE_EVENT(rpc_stats_latency, |
| 246 | |
| 247 | TP_PROTO( |
| 248 | const struct rpc_task *task, |
| 249 | ktime_t backlog, |
| 250 | ktime_t rtt, |
| 251 | ktime_t execute |
| 252 | ), |
| 253 | |
| 254 | TP_ARGS(task, backlog, rtt, execute), |
| 255 | |
| 256 | TP_STRUCT__entry( |
Chuck Lever | 98eb6cf | 2018-05-01 11:37:19 -0400 | [diff] [blame] | 257 | __field(unsigned int, task_id) |
| 258 | __field(unsigned int, client_id) |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 259 | __field(u32, xid) |
| 260 | __field(int, version) |
| 261 | __string(progname, task->tk_client->cl_program->name) |
| 262 | __string(procname, rpc_proc_name(task)) |
| 263 | __field(unsigned long, backlog) |
| 264 | __field(unsigned long, rtt) |
| 265 | __field(unsigned long, execute) |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 266 | ), |
| 267 | |
| 268 | TP_fast_assign( |
Chuck Lever | 98eb6cf | 2018-05-01 11:37:19 -0400 | [diff] [blame] | 269 | __entry->client_id = task->tk_client->cl_clid; |
| 270 | __entry->task_id = task->tk_pid; |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 271 | __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); |
| 272 | __entry->version = task->tk_client->cl_vers; |
| 273 | __assign_str(progname, task->tk_client->cl_program->name) |
| 274 | __assign_str(procname, rpc_proc_name(task)) |
| 275 | __entry->backlog = ktime_to_us(backlog); |
| 276 | __entry->rtt = ktime_to_us(rtt); |
| 277 | __entry->execute = ktime_to_us(execute); |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 278 | ), |
| 279 | |
Chuck Lever | 98eb6cf | 2018-05-01 11:37:19 -0400 | [diff] [blame] | 280 | TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", |
| 281 | __entry->task_id, __entry->client_id, __entry->xid, |
Chuck Lever | 40bf7eb | 2018-03-16 10:33:49 -0400 | [diff] [blame] | 282 | __get_str(progname), __entry->version, __get_str(procname), |
| 283 | __entry->backlog, __entry->rtt, __entry->execute) |
| 284 | ); |
| 285 | |
Chuck Lever | 5582863 | 2019-02-11 11:24:10 -0500 | [diff] [blame] | 286 | TRACE_EVENT(rpc_xdr_overflow, |
| 287 | TP_PROTO( |
| 288 | const struct xdr_stream *xdr, |
| 289 | size_t requested |
| 290 | ), |
| 291 | |
| 292 | TP_ARGS(xdr, requested), |
| 293 | |
| 294 | TP_STRUCT__entry( |
| 295 | __field(unsigned int, task_id) |
| 296 | __field(unsigned int, client_id) |
| 297 | __field(int, version) |
| 298 | __field(size_t, requested) |
| 299 | __field(const void *, end) |
| 300 | __field(const void *, p) |
| 301 | __field(const void *, head_base) |
| 302 | __field(size_t, head_len) |
| 303 | __field(const void *, tail_base) |
| 304 | __field(size_t, tail_len) |
| 305 | __field(unsigned int, page_len) |
| 306 | __field(unsigned int, len) |
| 307 | __string(progname, |
| 308 | xdr->rqst->rq_task->tk_client->cl_program->name) |
| 309 | __string(procedure, |
| 310 | xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) |
| 311 | ), |
| 312 | |
| 313 | TP_fast_assign( |
| 314 | if (xdr->rqst) { |
| 315 | const struct rpc_task *task = xdr->rqst->rq_task; |
| 316 | |
| 317 | __entry->task_id = task->tk_pid; |
| 318 | __entry->client_id = task->tk_client->cl_clid; |
| 319 | __assign_str(progname, |
| 320 | task->tk_client->cl_program->name) |
| 321 | __entry->version = task->tk_client->cl_vers; |
| 322 | __assign_str(procedure, task->tk_msg.rpc_proc->p_name) |
| 323 | } else { |
| 324 | __entry->task_id = 0; |
| 325 | __entry->client_id = 0; |
| 326 | __assign_str(progname, "unknown") |
| 327 | __entry->version = 0; |
| 328 | __assign_str(procedure, "unknown") |
| 329 | } |
| 330 | __entry->requested = requested; |
| 331 | __entry->end = xdr->end; |
| 332 | __entry->p = xdr->p; |
| 333 | __entry->head_base = xdr->buf->head[0].iov_base, |
| 334 | __entry->head_len = xdr->buf->head[0].iov_len, |
| 335 | __entry->page_len = xdr->buf->page_len, |
| 336 | __entry->tail_base = xdr->buf->tail[0].iov_base, |
| 337 | __entry->tail_len = xdr->buf->tail[0].iov_len, |
| 338 | __entry->len = xdr->buf->len; |
| 339 | ), |
| 340 | |
| 341 | TP_printk( |
| 342 | "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", |
| 343 | __entry->task_id, __entry->client_id, |
| 344 | __get_str(progname), __entry->version, __get_str(procedure), |
| 345 | __entry->requested, __entry->p, __entry->end, |
| 346 | __entry->head_base, __entry->head_len, |
| 347 | __entry->page_len, |
| 348 | __entry->tail_base, __entry->tail_len, |
| 349 | __entry->len |
| 350 | ) |
| 351 | ); |
| 352 | |
Chuck Lever | 7be9cea3 | 2019-02-11 11:24:16 -0500 | [diff] [blame] | 353 | TRACE_EVENT(rpc_xdr_alignment, |
| 354 | TP_PROTO( |
| 355 | const struct xdr_stream *xdr, |
| 356 | size_t offset, |
| 357 | unsigned int copied |
| 358 | ), |
| 359 | |
| 360 | TP_ARGS(xdr, offset, copied), |
| 361 | |
| 362 | TP_STRUCT__entry( |
| 363 | __field(unsigned int, task_id) |
| 364 | __field(unsigned int, client_id) |
| 365 | __field(int, version) |
| 366 | __field(size_t, offset) |
| 367 | __field(unsigned int, copied) |
| 368 | __field(const void *, head_base) |
| 369 | __field(size_t, head_len) |
| 370 | __field(const void *, tail_base) |
| 371 | __field(size_t, tail_len) |
| 372 | __field(unsigned int, page_len) |
| 373 | __field(unsigned int, len) |
| 374 | __string(progname, |
| 375 | xdr->rqst->rq_task->tk_client->cl_program->name) |
| 376 | __string(procedure, |
| 377 | xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) |
| 378 | ), |
| 379 | |
| 380 | TP_fast_assign( |
| 381 | const struct rpc_task *task = xdr->rqst->rq_task; |
| 382 | |
| 383 | __entry->task_id = task->tk_pid; |
| 384 | __entry->client_id = task->tk_client->cl_clid; |
| 385 | __assign_str(progname, |
| 386 | task->tk_client->cl_program->name) |
| 387 | __entry->version = task->tk_client->cl_vers; |
| 388 | __assign_str(procedure, task->tk_msg.rpc_proc->p_name) |
| 389 | |
| 390 | __entry->offset = offset; |
| 391 | __entry->copied = copied; |
| 392 | __entry->head_base = xdr->buf->head[0].iov_base, |
| 393 | __entry->head_len = xdr->buf->head[0].iov_len, |
| 394 | __entry->page_len = xdr->buf->page_len, |
| 395 | __entry->tail_base = xdr->buf->tail[0].iov_base, |
| 396 | __entry->tail_len = xdr->buf->tail[0].iov_len, |
| 397 | __entry->len = xdr->buf->len; |
| 398 | ), |
| 399 | |
| 400 | TP_printk( |
| 401 | "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", |
| 402 | __entry->task_id, __entry->client_id, |
| 403 | __get_str(progname), __entry->version, __get_str(procedure), |
| 404 | __entry->offset, __entry->copied, |
| 405 | __entry->head_base, __entry->head_len, |
| 406 | __entry->page_len, |
| 407 | __entry->tail_base, __entry->tail_len, |
| 408 | __entry->len |
| 409 | ) |
| 410 | ); |
| 411 | |
Steven Rostedt (Red Hat) | 6ba16ee | 2015-03-27 16:53:03 -0400 | [diff] [blame] | 412 | /* |
| 413 | * First define the enums in the below macros to be exported to userspace |
| 414 | * via TRACE_DEFINE_ENUM(). |
| 415 | */ |
| 416 | #undef EM |
| 417 | #undef EMe |
| 418 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 419 | #define EMe(a, b) TRACE_DEFINE_ENUM(a); |
| 420 | |
| 421 | #define RPC_SHOW_SOCKET \ |
| 422 | EM( SS_FREE, "FREE" ) \ |
| 423 | EM( SS_UNCONNECTED, "UNCONNECTED" ) \ |
| 424 | EM( SS_CONNECTING, "CONNECTING," ) \ |
| 425 | EM( SS_CONNECTED, "CONNECTED," ) \ |
| 426 | EMe(SS_DISCONNECTING, "DISCONNECTING" ) |
| 427 | |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 428 | #define rpc_show_socket_state(state) \ |
Steven Rostedt (Red Hat) | 6ba16ee | 2015-03-27 16:53:03 -0400 | [diff] [blame] | 429 | __print_symbolic(state, RPC_SHOW_SOCKET) |
| 430 | |
| 431 | RPC_SHOW_SOCKET |
| 432 | |
| 433 | #define RPC_SHOW_SOCK \ |
| 434 | EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ |
| 435 | EM( TCP_SYN_SENT, "SYN_SENT" ) \ |
| 436 | EM( TCP_SYN_RECV, "SYN_RECV" ) \ |
| 437 | EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ |
| 438 | EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ |
| 439 | EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ |
| 440 | EM( TCP_CLOSE, "CLOSE" ) \ |
| 441 | EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ |
| 442 | EM( TCP_LAST_ACK, "LAST_ACK" ) \ |
| 443 | EM( TCP_LISTEN, "LISTEN" ) \ |
| 444 | EMe( TCP_CLOSING, "CLOSING" ) |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 445 | |
| 446 | #define rpc_show_sock_state(state) \ |
Steven Rostedt (Red Hat) | 6ba16ee | 2015-03-27 16:53:03 -0400 | [diff] [blame] | 447 | __print_symbolic(state, RPC_SHOW_SOCK) |
| 448 | |
| 449 | RPC_SHOW_SOCK |
| 450 | |
| 451 | /* |
| 452 | * Now redefine the EM() and EMe() macros to map the enums to the strings |
| 453 | * that will be printed in the output. |
| 454 | */ |
| 455 | #undef EM |
| 456 | #undef EMe |
| 457 | #define EM(a, b) {a, b}, |
| 458 | #define EMe(a, b) {a, b} |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 459 | |
| 460 | DECLARE_EVENT_CLASS(xs_socket_event, |
| 461 | |
| 462 | TP_PROTO( |
| 463 | struct rpc_xprt *xprt, |
| 464 | struct socket *socket |
| 465 | ), |
| 466 | |
| 467 | TP_ARGS(xprt, socket), |
| 468 | |
| 469 | TP_STRUCT__entry( |
| 470 | __field(unsigned int, socket_state) |
| 471 | __field(unsigned int, sock_state) |
| 472 | __field(unsigned long long, ino) |
| 473 | __string(dstaddr, |
| 474 | xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 475 | __string(dstport, |
| 476 | xprt->address_strings[RPC_DISPLAY_PORT]) |
| 477 | ), |
| 478 | |
| 479 | TP_fast_assign( |
| 480 | struct inode *inode = SOCK_INODE(socket); |
| 481 | __entry->socket_state = socket->state; |
| 482 | __entry->sock_state = socket->sk->sk_state; |
| 483 | __entry->ino = (unsigned long long)inode->i_ino; |
| 484 | __assign_str(dstaddr, |
| 485 | xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 486 | __assign_str(dstport, |
| 487 | xprt->address_strings[RPC_DISPLAY_PORT]); |
| 488 | ), |
| 489 | |
| 490 | TP_printk( |
| 491 | "socket:[%llu] dstaddr=%s/%s " |
| 492 | "state=%u (%s) sk_state=%u (%s)", |
| 493 | __entry->ino, __get_str(dstaddr), __get_str(dstport), |
| 494 | __entry->socket_state, |
| 495 | rpc_show_socket_state(__entry->socket_state), |
| 496 | __entry->sock_state, |
| 497 | rpc_show_sock_state(__entry->sock_state) |
| 498 | ) |
| 499 | ); |
| 500 | #define DEFINE_RPC_SOCKET_EVENT(name) \ |
| 501 | DEFINE_EVENT(xs_socket_event, name, \ |
| 502 | TP_PROTO( \ |
| 503 | struct rpc_xprt *xprt, \ |
| 504 | struct socket *socket \ |
| 505 | ), \ |
| 506 | TP_ARGS(xprt, socket)) |
| 507 | |
| 508 | DECLARE_EVENT_CLASS(xs_socket_event_done, |
| 509 | |
| 510 | TP_PROTO( |
| 511 | struct rpc_xprt *xprt, |
| 512 | struct socket *socket, |
| 513 | int error |
| 514 | ), |
| 515 | |
| 516 | TP_ARGS(xprt, socket, error), |
| 517 | |
| 518 | TP_STRUCT__entry( |
| 519 | __field(int, error) |
| 520 | __field(unsigned int, socket_state) |
| 521 | __field(unsigned int, sock_state) |
| 522 | __field(unsigned long long, ino) |
| 523 | __string(dstaddr, |
| 524 | xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 525 | __string(dstport, |
| 526 | xprt->address_strings[RPC_DISPLAY_PORT]) |
| 527 | ), |
| 528 | |
| 529 | TP_fast_assign( |
| 530 | struct inode *inode = SOCK_INODE(socket); |
| 531 | __entry->socket_state = socket->state; |
| 532 | __entry->sock_state = socket->sk->sk_state; |
| 533 | __entry->ino = (unsigned long long)inode->i_ino; |
| 534 | __entry->error = error; |
| 535 | __assign_str(dstaddr, |
| 536 | xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 537 | __assign_str(dstport, |
| 538 | xprt->address_strings[RPC_DISPLAY_PORT]); |
| 539 | ), |
| 540 | |
| 541 | TP_printk( |
| 542 | "error=%d socket:[%llu] dstaddr=%s/%s " |
| 543 | "state=%u (%s) sk_state=%u (%s)", |
| 544 | __entry->error, |
| 545 | __entry->ino, __get_str(dstaddr), __get_str(dstport), |
| 546 | __entry->socket_state, |
| 547 | rpc_show_socket_state(__entry->socket_state), |
| 548 | __entry->sock_state, |
| 549 | rpc_show_sock_state(__entry->sock_state) |
| 550 | ) |
| 551 | ); |
| 552 | #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ |
| 553 | DEFINE_EVENT(xs_socket_event_done, name, \ |
| 554 | TP_PROTO( \ |
| 555 | struct rpc_xprt *xprt, \ |
| 556 | struct socket *socket, \ |
| 557 | int error \ |
| 558 | ), \ |
| 559 | TP_ARGS(xprt, socket, error)) |
| 560 | |
| 561 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); |
| 562 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); |
Trond Myklebust | e8353c76 | 2013-12-31 13:39:22 -0500 | [diff] [blame] | 563 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 564 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); |
| 565 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); |
| 566 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); |
| 567 | |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 568 | DECLARE_EVENT_CLASS(rpc_xprt_event, |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 569 | TP_PROTO( |
| 570 | const struct rpc_xprt *xprt, |
| 571 | __be32 xid, |
| 572 | int status |
| 573 | ), |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 574 | |
| 575 | TP_ARGS(xprt, xid, status), |
| 576 | |
| 577 | TP_STRUCT__entry( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 578 | __field(u32, xid) |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 579 | __field(int, status) |
| 580 | __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 581 | __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) |
| 582 | ), |
| 583 | |
| 584 | TP_fast_assign( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 585 | __entry->xid = be32_to_cpu(xid); |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 586 | __entry->status = status; |
| 587 | __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 588 | __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); |
| 589 | ), |
| 590 | |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 591 | TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), |
| 592 | __get_str(port), __entry->xid, |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 593 | __entry->status) |
| 594 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 595 | #define DEFINE_RPC_XPRT_EVENT(name) \ |
| 596 | DEFINE_EVENT(rpc_xprt_event, xprt_##name, \ |
| 597 | TP_PROTO( \ |
| 598 | const struct rpc_xprt *xprt, \ |
| 599 | __be32 xid, \ |
| 600 | int status \ |
| 601 | ), \ |
| 602 | TP_ARGS(xprt, xid, status)) |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 603 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 604 | DEFINE_RPC_XPRT_EVENT(timer); |
| 605 | DEFINE_RPC_XPRT_EVENT(lookup_rqst); |
| 606 | DEFINE_RPC_XPRT_EVENT(transmit); |
| 607 | DEFINE_RPC_XPRT_EVENT(complete_rqst); |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 608 | |
Chuck Lever | a25a4cb | 2018-03-16 10:33:55 -0400 | [diff] [blame] | 609 | TRACE_EVENT(xprt_ping, |
| 610 | TP_PROTO(const struct rpc_xprt *xprt, int status), |
| 611 | |
| 612 | TP_ARGS(xprt, status), |
| 613 | |
| 614 | TP_STRUCT__entry( |
| 615 | __field(int, status) |
| 616 | __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 617 | __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) |
| 618 | ), |
| 619 | |
| 620 | TP_fast_assign( |
| 621 | __entry->status = status; |
| 622 | __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 623 | __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); |
| 624 | ), |
| 625 | |
| 626 | TP_printk("peer=[%s]:%s status=%d", |
| 627 | __get_str(addr), __get_str(port), __entry->status) |
| 628 | ); |
| 629 | |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 630 | TRACE_EVENT(xs_stream_read_data, |
| 631 | TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total), |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 632 | |
| 633 | TP_ARGS(xprt, err, total), |
| 634 | |
| 635 | TP_STRUCT__entry( |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 636 | __field(ssize_t, err) |
| 637 | __field(size_t, total) |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 638 | __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] : |
| 639 | "(null)") |
| 640 | __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] : |
| 641 | "(null)") |
| 642 | ), |
| 643 | |
| 644 | TP_fast_assign( |
| 645 | __entry->err = err; |
| 646 | __entry->total = total; |
| 647 | __assign_str(addr, xprt ? |
| 648 | xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)"); |
| 649 | __assign_str(port, xprt ? |
| 650 | xprt->address_strings[RPC_DISPLAY_PORT] : "(null)"); |
| 651 | ), |
| 652 | |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 653 | TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr), |
Jeff Layton | 3705ad6 | 2014-10-28 14:24:13 -0400 | [diff] [blame] | 654 | __get_str(port), __entry->err, __entry->total) |
| 655 | ); |
| 656 | |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 657 | TRACE_EVENT(xs_stream_read_request, |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 658 | TP_PROTO(struct sock_xprt *xs), |
| 659 | |
| 660 | TP_ARGS(xs), |
| 661 | |
| 662 | TP_STRUCT__entry( |
| 663 | __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]) |
| 664 | __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 665 | __field(u32, xid) |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 666 | __field(unsigned long, copied) |
| 667 | __field(unsigned int, reclen) |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 668 | __field(unsigned int, offset) |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 669 | ), |
| 670 | |
| 671 | TP_fast_assign( |
| 672 | __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]); |
| 673 | __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); |
Trond Myklebust | d1109aa | 2018-08-13 15:48:42 -0400 | [diff] [blame] | 674 | __entry->xid = be32_to_cpu(xs->recv.xid); |
Trond Myklebust | d1109aa | 2018-08-13 15:48:42 -0400 | [diff] [blame] | 675 | __entry->copied = xs->recv.copied; |
| 676 | __entry->reclen = xs->recv.len; |
| 677 | __entry->offset = xs->recv.offset; |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 678 | ), |
| 679 | |
Trond Myklebust | c50b8ee | 2018-09-14 14:26:28 -0400 | [diff] [blame] | 680 | TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u", |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 681 | __get_str(addr), __get_str(port), __entry->xid, |
Jeff Layton | 1a867a0 | 2014-10-28 14:24:14 -0400 | [diff] [blame] | 682 | __entry->copied, __entry->reclen, __entry->offset) |
| 683 | ); |
| 684 | |
Jeff Layton | 30660e04b | 2014-11-19 07:51:16 -0500 | [diff] [blame] | 685 | #define show_rqstp_flags(flags) \ |
| 686 | __print_flags(flags, "|", \ |
| 687 | { (1UL << RQ_SECURE), "RQ_SECURE"}, \ |
| 688 | { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \ |
Jeff Layton | 78b65eb | 2014-11-19 07:51:17 -0500 | [diff] [blame] | 689 | { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \ |
Jeff Layton | 779fb0f | 2014-11-19 07:51:18 -0500 | [diff] [blame] | 690 | { (1UL << RQ_DROPME), "RQ_DROPME"}, \ |
Jeff Layton | 8124438 | 2014-11-21 14:19:28 -0500 | [diff] [blame] | 691 | { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \ |
Jeff Layton | b1691bc | 2014-11-21 14:19:30 -0500 | [diff] [blame] | 692 | { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \ |
| 693 | { (1UL << RQ_BUSY), "RQ_BUSY"}) |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 694 | |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 695 | TRACE_EVENT(svc_recv, |
Chuck Lever | 41f306d | 2018-03-27 10:50:42 -0400 | [diff] [blame] | 696 | TP_PROTO(struct svc_rqst *rqst, int len), |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 697 | |
Chuck Lever | 41f306d | 2018-03-27 10:50:42 -0400 | [diff] [blame] | 698 | TP_ARGS(rqst, len), |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 699 | |
| 700 | TP_STRUCT__entry( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 701 | __field(u32, xid) |
Chuck Lever | 41f306d | 2018-03-27 10:50:42 -0400 | [diff] [blame] | 702 | __field(int, len) |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 703 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 704 | __string(addr, rqst->rq_xprt->xpt_remotebuf) |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 705 | ), |
| 706 | |
| 707 | TP_fast_assign( |
Chuck Lever | 41f306d | 2018-03-27 10:50:42 -0400 | [diff] [blame] | 708 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
| 709 | __entry->len = len; |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 710 | __entry->flags = rqst->rq_flags; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 711 | __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 712 | ), |
| 713 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 714 | TP_printk("addr=%s xid=0x%08x len=%d flags=%s", |
| 715 | __get_str(addr), __entry->xid, __entry->len, |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 716 | show_rqstp_flags(__entry->flags)) |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 717 | ); |
| 718 | |
Chuck Lever | 0b9547b | 2018-03-27 10:51:22 -0400 | [diff] [blame] | 719 | TRACE_EVENT(svc_process, |
| 720 | TP_PROTO(const struct svc_rqst *rqst, const char *name), |
| 721 | |
| 722 | TP_ARGS(rqst, name), |
| 723 | |
| 724 | TP_STRUCT__entry( |
| 725 | __field(u32, xid) |
| 726 | __field(u32, vers) |
| 727 | __field(u32, proc) |
| 728 | __string(service, name) |
Vasily Averin | d4b09ac | 2018-12-24 14:44:52 +0300 | [diff] [blame] | 729 | __string(addr, rqst->rq_xprt ? |
| 730 | rqst->rq_xprt->xpt_remotebuf : "(null)") |
Chuck Lever | 0b9547b | 2018-03-27 10:51:22 -0400 | [diff] [blame] | 731 | ), |
| 732 | |
| 733 | TP_fast_assign( |
| 734 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
| 735 | __entry->vers = rqst->rq_vers; |
| 736 | __entry->proc = rqst->rq_proc; |
| 737 | __assign_str(service, name); |
Vasily Averin | d4b09ac | 2018-12-24 14:44:52 +0300 | [diff] [blame] | 738 | __assign_str(addr, rqst->rq_xprt ? |
| 739 | rqst->rq_xprt->xpt_remotebuf : "(null)"); |
Chuck Lever | 0b9547b | 2018-03-27 10:51:22 -0400 | [diff] [blame] | 740 | ), |
| 741 | |
| 742 | TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u", |
| 743 | __get_str(addr), __entry->xid, |
| 744 | __get_str(service), __entry->vers, __entry->proc) |
| 745 | ); |
| 746 | |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 747 | DECLARE_EVENT_CLASS(svc_rqst_event, |
| 748 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 749 | TP_PROTO( |
| 750 | const struct svc_rqst *rqst |
| 751 | ), |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 752 | |
| 753 | TP_ARGS(rqst), |
| 754 | |
| 755 | TP_STRUCT__entry( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 756 | __field(u32, xid) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 757 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 758 | __string(addr, rqst->rq_xprt->xpt_remotebuf) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 759 | ), |
| 760 | |
| 761 | TP_fast_assign( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 762 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 763 | __entry->flags = rqst->rq_flags; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 764 | __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 765 | ), |
| 766 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 767 | TP_printk("addr=%s xid=0x%08x flags=%s", |
| 768 | __get_str(addr), __entry->xid, |
| 769 | show_rqstp_flags(__entry->flags)) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 770 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 771 | #define DEFINE_SVC_RQST_EVENT(name) \ |
| 772 | DEFINE_EVENT(svc_rqst_event, svc_##name, \ |
| 773 | TP_PROTO( \ |
| 774 | const struct svc_rqst *rqst \ |
| 775 | ), \ |
| 776 | TP_ARGS(rqst)) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 777 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 778 | DEFINE_SVC_RQST_EVENT(defer); |
| 779 | DEFINE_SVC_RQST_EVENT(drop); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 780 | |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 781 | DECLARE_EVENT_CLASS(svc_rqst_status, |
| 782 | |
| 783 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 784 | |
| 785 | TP_ARGS(rqst, status), |
| 786 | |
| 787 | TP_STRUCT__entry( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 788 | __field(u32, xid) |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 789 | __field(int, status) |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 790 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 791 | __string(addr, rqst->rq_xprt->xpt_remotebuf) |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 792 | ), |
| 793 | |
| 794 | TP_fast_assign( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 795 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 796 | __entry->status = status; |
Jeff Layton | 4d152e2 | 2014-11-19 07:51:14 -0500 | [diff] [blame] | 797 | __entry->flags = rqst->rq_flags; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 798 | __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 799 | ), |
| 800 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 801 | TP_printk("addr=%s xid=0x%08x status=%d flags=%s", |
| 802 | __get_str(addr), __entry->xid, |
| 803 | __entry->status, show_rqstp_flags(__entry->flags)) |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 804 | ); |
| 805 | |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame] | 806 | DEFINE_EVENT(svc_rqst_status, svc_send, |
| 807 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 808 | TP_ARGS(rqst, status)); |
| 809 | |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 810 | #define show_svc_xprt_flags(flags) \ |
| 811 | __print_flags(flags, "|", \ |
| 812 | { (1UL << XPT_BUSY), "XPT_BUSY"}, \ |
| 813 | { (1UL << XPT_CONN), "XPT_CONN"}, \ |
| 814 | { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \ |
| 815 | { (1UL << XPT_DATA), "XPT_DATA"}, \ |
| 816 | { (1UL << XPT_TEMP), "XPT_TEMP"}, \ |
| 817 | { (1UL << XPT_DEAD), "XPT_DEAD"}, \ |
| 818 | { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \ |
| 819 | { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \ |
| 820 | { (1UL << XPT_OLD), "XPT_OLD"}, \ |
| 821 | { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \ |
| 822 | { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \ |
Chuck Lever | 03edb90 | 2018-03-27 10:49:53 -0400 | [diff] [blame] | 823 | { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \ |
| 824 | { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \ |
| 825 | { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"}) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 826 | |
| 827 | TRACE_EVENT(svc_xprt_do_enqueue, |
| 828 | TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst), |
| 829 | |
| 830 | TP_ARGS(xprt, rqst), |
| 831 | |
| 832 | TP_STRUCT__entry( |
| 833 | __field(struct svc_xprt *, xprt) |
Pratyush Anand | 051ac38 | 2015-08-27 10:01:33 +0530 | [diff] [blame] | 834 | __field(int, pid) |
| 835 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 836 | __string(addr, xprt->xpt_remotebuf) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 837 | ), |
| 838 | |
| 839 | TP_fast_assign( |
| 840 | __entry->xprt = xprt; |
Pratyush Anand | 051ac38 | 2015-08-27 10:01:33 +0530 | [diff] [blame] | 841 | __entry->pid = rqst? rqst->rq_task->pid : 0; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 842 | __entry->flags = xprt->xpt_flags; |
| 843 | __assign_str(addr, xprt->xpt_remotebuf); |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 844 | ), |
| 845 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 846 | TP_printk("xprt=%p addr=%s pid=%d flags=%s", |
| 847 | __entry->xprt, __get_str(addr), |
| 848 | __entry->pid, show_svc_xprt_flags(__entry->flags)) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 849 | ); |
| 850 | |
Trond Myklebust | 82ea2d7 | 2016-06-24 10:55:45 -0400 | [diff] [blame] | 851 | DECLARE_EVENT_CLASS(svc_xprt_event, |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 852 | TP_PROTO(struct svc_xprt *xprt), |
| 853 | |
| 854 | TP_ARGS(xprt), |
| 855 | |
| 856 | TP_STRUCT__entry( |
| 857 | __field(struct svc_xprt *, xprt) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 858 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 859 | __string(addr, xprt->xpt_remotebuf) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 860 | ), |
| 861 | |
| 862 | TP_fast_assign( |
Trond Myklebust | db1bb44 | 2016-06-24 10:55:44 -0400 | [diff] [blame] | 863 | __entry->xprt = xprt; |
Chuck Lever | caa3e106d | 2018-03-27 10:50:07 -0400 | [diff] [blame] | 864 | __entry->flags = xprt->xpt_flags; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 865 | __assign_str(addr, xprt->xpt_remotebuf); |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 866 | ), |
| 867 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 868 | TP_printk("xprt=%p addr=%s flags=%s", |
| 869 | __entry->xprt, __get_str(addr), |
| 870 | show_svc_xprt_flags(__entry->flags)) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 871 | ); |
| 872 | |
Trond Myklebust | 82ea2d7 | 2016-06-24 10:55:45 -0400 | [diff] [blame] | 873 | DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space, |
| 874 | TP_PROTO(struct svc_xprt *xprt), |
| 875 | TP_ARGS(xprt)); |
| 876 | |
Chuck Lever | 55f5088 | 2018-03-27 10:52:27 -0400 | [diff] [blame] | 877 | TRACE_EVENT(svc_xprt_dequeue, |
| 878 | TP_PROTO(struct svc_rqst *rqst), |
| 879 | |
| 880 | TP_ARGS(rqst), |
| 881 | |
| 882 | TP_STRUCT__entry( |
| 883 | __field(struct svc_xprt *, xprt) |
| 884 | __field(unsigned long, flags) |
| 885 | __field(unsigned long, wakeup) |
| 886 | __string(addr, rqst->rq_xprt->xpt_remotebuf) |
| 887 | ), |
| 888 | |
| 889 | TP_fast_assign( |
| 890 | __entry->xprt = rqst->rq_xprt; |
| 891 | __entry->flags = rqst->rq_xprt->xpt_flags; |
| 892 | __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(), |
| 893 | rqst->rq_qtime)); |
| 894 | __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
| 895 | ), |
| 896 | |
| 897 | TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu", |
| 898 | __entry->xprt, __get_str(addr), |
| 899 | show_svc_xprt_flags(__entry->flags), |
| 900 | __entry->wakeup) |
| 901 | ); |
| 902 | |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 903 | TRACE_EVENT(svc_wake_up, |
| 904 | TP_PROTO(int pid), |
| 905 | |
| 906 | TP_ARGS(pid), |
| 907 | |
| 908 | TP_STRUCT__entry( |
| 909 | __field(int, pid) |
| 910 | ), |
| 911 | |
| 912 | TP_fast_assign( |
| 913 | __entry->pid = pid; |
| 914 | ), |
| 915 | |
| 916 | TP_printk("pid=%d", __entry->pid) |
| 917 | ); |
| 918 | |
| 919 | TRACE_EVENT(svc_handle_xprt, |
| 920 | TP_PROTO(struct svc_xprt *xprt, int len), |
| 921 | |
| 922 | TP_ARGS(xprt, len), |
| 923 | |
| 924 | TP_STRUCT__entry( |
| 925 | __field(struct svc_xprt *, xprt) |
| 926 | __field(int, len) |
Pratyush Anand | 051ac38 | 2015-08-27 10:01:33 +0530 | [diff] [blame] | 927 | __field(unsigned long, flags) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 928 | __string(addr, xprt->xpt_remotebuf) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 929 | ), |
| 930 | |
| 931 | TP_fast_assign( |
| 932 | __entry->xprt = xprt; |
| 933 | __entry->len = len; |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 934 | __entry->flags = xprt->xpt_flags; |
| 935 | __assign_str(addr, xprt->xpt_remotebuf); |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 936 | ), |
| 937 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 938 | TP_printk("xprt=%p addr=%s len=%d flags=%s", |
| 939 | __entry->xprt, __get_str(addr), |
Pratyush Anand | 051ac38 | 2015-08-27 10:01:33 +0530 | [diff] [blame] | 940 | __entry->len, show_svc_xprt_flags(__entry->flags)) |
Jeff Layton | 83a712e | 2014-11-21 14:19:31 -0500 | [diff] [blame] | 941 | ); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 942 | |
Chuck Lever | aaba72c | 2018-03-27 10:51:39 -0400 | [diff] [blame] | 943 | TRACE_EVENT(svc_stats_latency, |
| 944 | TP_PROTO(const struct svc_rqst *rqst), |
| 945 | |
| 946 | TP_ARGS(rqst), |
| 947 | |
| 948 | TP_STRUCT__entry( |
| 949 | __field(u32, xid) |
| 950 | __field(unsigned long, execute) |
| 951 | __string(addr, rqst->rq_xprt->xpt_remotebuf) |
| 952 | ), |
| 953 | |
| 954 | TP_fast_assign( |
| 955 | __entry->xid = be32_to_cpu(rqst->rq_xid); |
| 956 | __entry->execute = ktime_to_us(ktime_sub(ktime_get(), |
| 957 | rqst->rq_stime)); |
| 958 | __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); |
| 959 | ), |
| 960 | |
| 961 | TP_printk("addr=%s xid=0x%08x execute-us=%lu", |
| 962 | __get_str(addr), __entry->xid, __entry->execute) |
| 963 | ); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 964 | |
| 965 | DECLARE_EVENT_CLASS(svc_deferred_event, |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 966 | TP_PROTO( |
| 967 | const struct svc_deferred_req *dr |
| 968 | ), |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 969 | |
| 970 | TP_ARGS(dr), |
| 971 | |
| 972 | TP_STRUCT__entry( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 973 | __field(u32, xid) |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 974 | __string(addr, dr->xprt->xpt_remotebuf) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 975 | ), |
| 976 | |
| 977 | TP_fast_assign( |
Chuck Lever | a30ccf1 | 2017-10-20 10:35:18 -0400 | [diff] [blame] | 978 | __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + |
| 979 | (dr->xprt_hlen>>2))); |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 980 | __assign_str(addr, dr->xprt->xpt_remotebuf); |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 981 | ), |
| 982 | |
Chuck Lever | ece200d | 2018-03-27 10:51:00 -0400 | [diff] [blame] | 983 | TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 984 | ); |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 985 | #define DEFINE_SVC_DEFERRED_EVENT(name) \ |
| 986 | DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \ |
| 987 | TP_PROTO( \ |
| 988 | const struct svc_deferred_req *dr \ |
| 989 | ), \ |
| 990 | TP_ARGS(dr)) |
Trond Myklebust | 104f635 | 2016-06-24 10:55:46 -0400 | [diff] [blame] | 991 | |
Chuck Lever | dc5820b | 2018-12-19 11:00:16 -0500 | [diff] [blame] | 992 | DEFINE_SVC_DEFERRED_EVENT(drop); |
| 993 | DEFINE_SVC_DEFERRED_EVENT(revisit); |
| 994 | |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 995 | #endif /* _TRACE_SUNRPC_H */ |
| 996 | |
| 997 | #include <trace/define_trace.h> |