blob: fb016308c18596dece630eabf4c6cfac3d855f4c [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Trond Myklebust82b0a4c2012-01-20 14:52:23 -05002#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 Layton860a0d92014-10-28 14:24:12 -040010#include <linux/sunrpc/svc.h>
Jeff Layton1a867a02014-10-28 14:24:14 -040011#include <linux/sunrpc/xprtsock.h>
Jeff Layton83a712e2014-11-21 14:19:31 -050012#include <linux/sunrpc/svc_xprt.h>
Trond Myklebust40b5ea02013-09-04 12:16:23 -040013#include <net/tcp_states.h>
14#include <linux/net.h>
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050015#include <linux/tracepoint.h>
16
Chuck Lever998024d2020-03-17 15:06:31 -040017TRACE_DEFINE_ENUM(SOCK_STREAM);
18TRACE_DEFINE_ENUM(SOCK_DGRAM);
19TRACE_DEFINE_ENUM(SOCK_RAW);
20TRACE_DEFINE_ENUM(SOCK_RDM);
21TRACE_DEFINE_ENUM(SOCK_SEQPACKET);
22TRACE_DEFINE_ENUM(SOCK_DCCP);
23TRACE_DEFINE_ENUM(SOCK_PACKET);
24
25#define show_socket_type(type) \
26 __print_symbolic(type, \
27 { SOCK_STREAM, "STREAM" }, \
28 { SOCK_DGRAM, "DGRAM" }, \
29 { SOCK_RAW, "RAW" }, \
30 { SOCK_RDM, "RDM" }, \
31 { SOCK_SEQPACKET, "SEQPACKET" }, \
32 { SOCK_DCCP, "DCCP" }, \
33 { SOCK_PACKET, "PACKET" })
34
35/* This list is known to be incomplete, add new enums as needed. */
36TRACE_DEFINE_ENUM(AF_UNSPEC);
37TRACE_DEFINE_ENUM(AF_UNIX);
38TRACE_DEFINE_ENUM(AF_LOCAL);
39TRACE_DEFINE_ENUM(AF_INET);
40TRACE_DEFINE_ENUM(AF_INET6);
41
42#define rpc_show_address_family(family) \
43 __print_symbolic(family, \
44 { AF_UNSPEC, "AF_UNSPEC" }, \
45 { AF_UNIX, "AF_UNIX" }, \
46 { AF_LOCAL, "AF_LOCAL" }, \
47 { AF_INET, "AF_INET" }, \
48 { AF_INET6, "AF_INET6" })
49
Chuck Leverc509f15a2020-05-12 17:13:28 -040050DECLARE_EVENT_CLASS(rpc_xdr_buf_class,
Chuck Leverb20dfc32020-03-02 15:01:08 -050051 TP_PROTO(
Chuck Leverc509f15a2020-05-12 17:13:28 -040052 const struct rpc_task *task,
Chuck Leverb20dfc32020-03-02 15:01:08 -050053 const struct xdr_buf *xdr
54 ),
55
Chuck Leverc509f15a2020-05-12 17:13:28 -040056 TP_ARGS(task, xdr),
Chuck Leverb20dfc32020-03-02 15:01:08 -050057
58 TP_STRUCT__entry(
Chuck Leverc509f15a2020-05-12 17:13:28 -040059 __field(unsigned int, task_id)
60 __field(unsigned int, client_id)
Chuck Leverb20dfc32020-03-02 15:01:08 -050061 __field(const void *, head_base)
62 __field(size_t, head_len)
63 __field(const void *, tail_base)
64 __field(size_t, tail_len)
65 __field(unsigned int, page_len)
66 __field(unsigned int, msg_len)
67 ),
68
69 TP_fast_assign(
Chuck Leverc509f15a2020-05-12 17:13:28 -040070 __entry->task_id = task->tk_pid;
Scott Mayhewc3213d22020-11-12 15:17:32 -050071 __entry->client_id = task->tk_client ?
72 task->tk_client->cl_clid : -1;
Chuck Leverb20dfc32020-03-02 15:01:08 -050073 __entry->head_base = xdr->head[0].iov_base;
74 __entry->head_len = xdr->head[0].iov_len;
75 __entry->tail_base = xdr->tail[0].iov_base;
76 __entry->tail_len = xdr->tail[0].iov_len;
77 __entry->page_len = xdr->page_len;
78 __entry->msg_len = xdr->len;
79 ),
80
Chuck Leverc509f15a2020-05-12 17:13:28 -040081 TP_printk("task:%u@%u head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
82 __entry->task_id, __entry->client_id,
Chuck Leverb20dfc32020-03-02 15:01:08 -050083 __entry->head_base, __entry->head_len, __entry->page_len,
84 __entry->tail_base, __entry->tail_len, __entry->msg_len
85 )
86);
87
Chuck Leverc509f15a2020-05-12 17:13:28 -040088#define DEFINE_RPCXDRBUF_EVENT(name) \
89 DEFINE_EVENT(rpc_xdr_buf_class, \
90 rpc_xdr_##name, \
Chuck Leverb20dfc32020-03-02 15:01:08 -050091 TP_PROTO( \
Chuck Leverc509f15a2020-05-12 17:13:28 -040092 const struct rpc_task *task, \
Chuck Leverb20dfc32020-03-02 15:01:08 -050093 const struct xdr_buf *xdr \
94 ), \
Chuck Leverc509f15a2020-05-12 17:13:28 -040095 TP_ARGS(task, xdr))
Chuck Leverb20dfc32020-03-02 15:01:08 -050096
Chuck Leverc509f15a2020-05-12 17:13:28 -040097DEFINE_RPCXDRBUF_EVENT(sendto);
98DEFINE_RPCXDRBUF_EVENT(recvfrom);
99DEFINE_RPCXDRBUF_EVENT(reply_pages);
100
Chuck Leverb20dfc32020-03-02 15:01:08 -0500101
Chuck Lever42aad0d2020-05-12 17:13:39 -0400102DECLARE_EVENT_CLASS(rpc_clnt_class,
103 TP_PROTO(
104 const struct rpc_clnt *clnt
105 ),
106
107 TP_ARGS(clnt),
108
109 TP_STRUCT__entry(
110 __field(unsigned int, client_id)
111 ),
112
113 TP_fast_assign(
114 __entry->client_id = clnt->cl_clid;
115 ),
116
117 TP_printk("clid=%u", __entry->client_id)
118);
119
120#define DEFINE_RPC_CLNT_EVENT(name) \
121 DEFINE_EVENT(rpc_clnt_class, \
122 rpc_clnt_##name, \
123 TP_PROTO( \
124 const struct rpc_clnt *clnt \
125 ), \
126 TP_ARGS(clnt))
127
128DEFINE_RPC_CLNT_EVENT(free);
129DEFINE_RPC_CLNT_EVENT(killall);
130DEFINE_RPC_CLNT_EVENT(shutdown);
131DEFINE_RPC_CLNT_EVENT(release);
132DEFINE_RPC_CLNT_EVENT(replace_xprt);
133DEFINE_RPC_CLNT_EVENT(replace_xprt_err);
134
135TRACE_EVENT(rpc_clnt_new,
136 TP_PROTO(
137 const struct rpc_clnt *clnt,
138 const struct rpc_xprt *xprt,
139 const char *program,
140 const char *server
141 ),
142
143 TP_ARGS(clnt, xprt, program, server),
144
145 TP_STRUCT__entry(
146 __field(unsigned int, client_id)
147 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
148 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
149 __string(program, program)
150 __string(server, server)
151 ),
152
153 TP_fast_assign(
154 __entry->client_id = clnt->cl_clid;
155 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
156 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
Joe Perches78c14b32021-06-12 08:42:27 -0700157 __assign_str(program, program);
158 __assign_str(server, server);
Chuck Lever42aad0d2020-05-12 17:13:39 -0400159 ),
160
161 TP_printk("client=%u peer=[%s]:%s program=%s server=%s",
162 __entry->client_id, __get_str(addr), __get_str(port),
163 __get_str(program), __get_str(server))
164);
165
166TRACE_EVENT(rpc_clnt_new_err,
167 TP_PROTO(
168 const char *program,
169 const char *server,
170 int error
171 ),
172
173 TP_ARGS(program, server, error),
174
175 TP_STRUCT__entry(
176 __field(int, error)
177 __string(program, program)
178 __string(server, server)
179 ),
180
181 TP_fast_assign(
182 __entry->error = error;
Joe Perches78c14b32021-06-12 08:42:27 -0700183 __assign_str(program, program);
184 __assign_str(server, server);
Chuck Lever42aad0d2020-05-12 17:13:39 -0400185 ),
186
187 TP_printk("program=%s server=%s error=%d",
188 __get_str(program), __get_str(server), __entry->error)
189);
190
191TRACE_EVENT(rpc_clnt_clone_err,
192 TP_PROTO(
193 const struct rpc_clnt *clnt,
194 int error
195 ),
196
197 TP_ARGS(clnt, error),
198
199 TP_STRUCT__entry(
200 __field(unsigned int, client_id)
201 __field(int, error)
202 ),
203
204 TP_fast_assign(
205 __entry->client_id = clnt->cl_clid;
206 __entry->error = error;
207 ),
208
209 TP_printk("client=%u error=%d", __entry->client_id, __entry->error)
210);
211
Chuck Leverdc5820b2018-12-19 11:00:16 -0500212
213TRACE_DEFINE_ENUM(RPC_AUTH_OK);
214TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED);
215TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED);
216TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF);
217TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF);
218TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK);
219TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM);
220TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM);
221
Steve Dickson5753cba2012-02-06 10:08:08 -0500222#define rpc_show_auth_stat(status) \
Chuck Leverc435da62017-11-03 13:46:14 -0400223 __print_symbolic(status, \
224 { RPC_AUTH_OK, "AUTH_OK" }, \
225 { RPC_AUTH_BADCRED, "BADCRED" }, \
226 { RPC_AUTH_REJECTEDCRED, "REJECTEDCRED" }, \
227 { RPC_AUTH_BADVERF, "BADVERF" }, \
228 { RPC_AUTH_REJECTEDVERF, "REJECTEDVERF" }, \
229 { RPC_AUTH_TOOWEAK, "TOOWEAK" }, \
230 { RPCSEC_GSS_CREDPROBLEM, "GSS_CREDPROBLEM" }, \
231 { RPCSEC_GSS_CTXPROBLEM, "GSS_CTXPROBLEM" }) \
232
233DECLARE_EVENT_CLASS(rpc_task_status,
234
235 TP_PROTO(const struct rpc_task *task),
236
237 TP_ARGS(task),
238
239 TP_STRUCT__entry(
240 __field(unsigned int, task_id)
241 __field(unsigned int, client_id)
242 __field(int, status)
243 ),
244
245 TP_fast_assign(
246 __entry->task_id = task->tk_pid;
247 __entry->client_id = task->tk_client->cl_clid;
248 __entry->status = task->tk_status;
249 ),
250
251 TP_printk("task:%u@%u status=%d",
252 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500253 __entry->status)
254);
255#define DEFINE_RPC_STATUS_EVENT(name) \
256 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
257 TP_PROTO( \
Chuck Lever6f7013832019-02-11 11:24:00 -0500258 const struct rpc_task *task \
259 ), \
260 TP_ARGS(task))
261
262DEFINE_RPC_STATUS_EVENT(call);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500263DEFINE_RPC_STATUS_EVENT(connect);
Chuck Lever914cdcc2020-07-08 16:09:58 -0400264DEFINE_RPC_STATUS_EVENT(timeout);
Chuck Lever7c8099f2020-07-08 16:10:03 -0400265DEFINE_RPC_STATUS_EVENT(retry_refresh);
266DEFINE_RPC_STATUS_EVENT(refresh);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500267
268TRACE_EVENT(rpc_request,
269 TP_PROTO(const struct rpc_task *task),
270
271 TP_ARGS(task),
272
273 TP_STRUCT__entry(
274 __field(unsigned int, task_id)
275 __field(unsigned int, client_id)
276 __field(int, version)
277 __field(bool, async)
278 __string(progname, task->tk_client->cl_program->name)
279 __string(procname, rpc_proc_name(task))
280 ),
281
282 TP_fast_assign(
283 __entry->task_id = task->tk_pid;
284 __entry->client_id = task->tk_client->cl_clid;
285 __entry->version = task->tk_client->cl_vers;
286 __entry->async = RPC_IS_ASYNC(task);
Joe Perches78c14b32021-06-12 08:42:27 -0700287 __assign_str(progname, task->tk_client->cl_program->name);
288 __assign_str(procname, rpc_proc_name(task));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500289 ),
290
291 TP_printk("task:%u@%u %sv%d %s (%ssync)",
292 __entry->task_id, __entry->client_id,
293 __get_str(progname), __entry->version,
294 __get_str(procname), __entry->async ? "a": ""
295 )
296);
Chuck Lever6f7013832019-02-11 11:24:00 -0500297
Chuck Lever6f7013832019-02-11 11:24:00 -0500298#define rpc_show_task_flags(flags) \
299 __print_flags(flags, "|", \
300 { RPC_TASK_ASYNC, "ASYNC" }, \
301 { RPC_TASK_SWAPPER, "SWAPPER" }, \
Chuck Leverf9d091c2021-07-19 10:48:22 -0400302 { RPC_TASK_MOVEABLE, "MOVEABLE" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400303 { RPC_TASK_NULLCREDS, "NULLCREDS" }, \
Chuck Lever6f7013832019-02-11 11:24:00 -0500304 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \
305 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \
306 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400307 { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \
Chuck Lever6f7013832019-02-11 11:24:00 -0500308 { RPC_TASK_SOFT, "SOFT" }, \
309 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \
310 { RPC_TASK_SENT, "SENT" }, \
311 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \
312 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400313 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }, \
314 { RPC_TASK_CRED_NOREF, "CRED_NOREF" })
Chuck Lever6f7013832019-02-11 11:24:00 -0500315
Chuck Lever6f7013832019-02-11 11:24:00 -0500316#define rpc_show_runstate(flags) \
317 __print_flags(flags, "|", \
318 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \
319 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \
320 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \
321 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \
322 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \
Trond Myklebustae67bd32019-04-07 13:58:44 -0400323 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }, \
324 { (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" })
Chuck Lever6f7013832019-02-11 11:24:00 -0500325
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500326DECLARE_EVENT_CLASS(rpc_task_running,
327
Chuck Levere671edb2018-03-16 10:33:44 -0400328 TP_PROTO(const struct rpc_task *task, const void *action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500329
Chuck Levere671edb2018-03-16 10:33:44 -0400330 TP_ARGS(task, action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500331
332 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400333 __field(unsigned int, task_id)
334 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500335 __field(const void *, action)
336 __field(unsigned long, runstate)
337 __field(int, status)
338 __field(unsigned short, flags)
339 ),
340
341 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400342 __entry->client_id = task->tk_client ?
343 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400344 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500345 __entry->action = action;
346 __entry->runstate = task->tk_runstate;
347 __entry->status = task->tk_status;
348 __entry->flags = task->tk_flags;
349 ),
350
Linus Torvalds09686212019-05-07 09:18:12 -0700351 TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400352 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500353 rpc_show_task_flags(__entry->flags),
354 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500355 __entry->status,
356 __entry->action
357 )
358);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500359#define DEFINE_RPC_RUNNING_EVENT(name) \
360 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
361 TP_PROTO( \
362 const struct rpc_task *task, \
363 const void *action \
364 ), \
365 TP_ARGS(task, action))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500366
Chuck Leverdc5820b2018-12-19 11:00:16 -0500367DEFINE_RPC_RUNNING_EVENT(begin);
368DEFINE_RPC_RUNNING_EVENT(run_action);
Chuck Lever1466c222020-07-08 16:10:45 -0400369DEFINE_RPC_RUNNING_EVENT(sync_sleep);
370DEFINE_RPC_RUNNING_EVENT(sync_wake);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500371DEFINE_RPC_RUNNING_EVENT(complete);
Chuck Lever721a1d32020-07-08 16:10:50 -0400372DEFINE_RPC_RUNNING_EVENT(timeout);
Chuck Leverabf8af72019-12-23 10:28:28 -0500373DEFINE_RPC_RUNNING_EVENT(signalled);
Chuck Levera264aba2019-11-20 16:25:52 -0500374DEFINE_RPC_RUNNING_EVENT(end);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500375
376DECLARE_EVENT_CLASS(rpc_task_queued,
377
Chuck Levere671edb2018-03-16 10:33:44 -0400378 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500379
Chuck Levere671edb2018-03-16 10:33:44 -0400380 TP_ARGS(task, q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500381
382 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400383 __field(unsigned int, task_id)
384 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500385 __field(unsigned long, timeout)
386 __field(unsigned long, runstate)
387 __field(int, status)
388 __field(unsigned short, flags)
Trond Myklebust85c0d242012-02-06 10:31:35 -0500389 __string(q_name, rpc_qname(q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500390 ),
391
392 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400393 __entry->client_id = task->tk_client ?
394 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400395 __entry->task_id = task->tk_pid;
Trond Myklebust5efd1872019-04-07 13:58:50 -0400396 __entry->timeout = rpc_task_timeout(task);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500397 __entry->runstate = task->tk_runstate;
398 __entry->status = task->tk_status;
399 __entry->flags = task->tk_flags;
Trond Myklebust85c0d242012-02-06 10:31:35 -0500400 __assign_str(q_name, rpc_qname(q));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500401 ),
402
Chuck Lever6f7013832019-02-11 11:24:00 -0500403 TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400404 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500405 rpc_show_task_flags(__entry->flags),
406 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500407 __entry->status,
408 __entry->timeout,
Trond Myklebust85c0d242012-02-06 10:31:35 -0500409 __get_str(q_name)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500410 )
411);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500412#define DEFINE_RPC_QUEUED_EVENT(name) \
413 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
414 TP_PROTO( \
415 const struct rpc_task *task, \
416 const struct rpc_wait_queue *q \
417 ), \
418 TP_ARGS(task, q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500419
Chuck Leverdc5820b2018-12-19 11:00:16 -0500420DEFINE_RPC_QUEUED_EVENT(sleep);
421DEFINE_RPC_QUEUED_EVENT(wakeup);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500422
Chuck Levere8680a22019-02-11 11:24:48 -0500423DECLARE_EVENT_CLASS(rpc_failure,
424
425 TP_PROTO(const struct rpc_task *task),
426
427 TP_ARGS(task),
428
429 TP_STRUCT__entry(
430 __field(unsigned int, task_id)
431 __field(unsigned int, client_id)
432 ),
433
434 TP_fast_assign(
435 __entry->task_id = task->tk_pid;
436 __entry->client_id = task->tk_client->cl_clid;
437 ),
438
439 TP_printk("task:%u@%u",
440 __entry->task_id, __entry->client_id)
441);
442
443#define DEFINE_RPC_FAILURE(name) \
444 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \
445 TP_PROTO( \
446 const struct rpc_task *task \
447 ), \
448 TP_ARGS(task))
449
450DEFINE_RPC_FAILURE(callhdr);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500451DEFINE_RPC_FAILURE(verifier);
452
453DECLARE_EVENT_CLASS(rpc_reply_event,
454
455 TP_PROTO(
456 const struct rpc_task *task
457 ),
458
459 TP_ARGS(task),
460
461 TP_STRUCT__entry(
462 __field(unsigned int, task_id)
463 __field(unsigned int, client_id)
464 __field(u32, xid)
465 __string(progname, task->tk_client->cl_program->name)
466 __field(u32, version)
467 __string(procname, rpc_proc_name(task))
468 __string(servername, task->tk_xprt->servername)
469 ),
470
471 TP_fast_assign(
472 __entry->task_id = task->tk_pid;
473 __entry->client_id = task->tk_client->cl_clid;
474 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
Joe Perches78c14b32021-06-12 08:42:27 -0700475 __assign_str(progname, task->tk_client->cl_program->name);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500476 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700477 __assign_str(procname, rpc_proc_name(task));
478 __assign_str(servername, task->tk_xprt->servername);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500479 ),
480
481 TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s",
482 __entry->task_id, __entry->client_id, __get_str(servername),
483 __entry->xid, __get_str(progname), __entry->version,
484 __get_str(procname))
485)
486
487#define DEFINE_RPC_REPLY_EVENT(name) \
488 DEFINE_EVENT(rpc_reply_event, rpc__##name, \
489 TP_PROTO( \
490 const struct rpc_task *task \
491 ), \
492 TP_ARGS(task))
493
494DEFINE_RPC_REPLY_EVENT(prog_unavail);
495DEFINE_RPC_REPLY_EVENT(prog_mismatch);
496DEFINE_RPC_REPLY_EVENT(proc_unavail);
497DEFINE_RPC_REPLY_EVENT(garbage_args);
498DEFINE_RPC_REPLY_EVENT(unparsable);
499DEFINE_RPC_REPLY_EVENT(mismatch);
500DEFINE_RPC_REPLY_EVENT(stale_creds);
501DEFINE_RPC_REPLY_EVENT(bad_creds);
502DEFINE_RPC_REPLY_EVENT(auth_tooweak);
Chuck Levere8680a22019-02-11 11:24:48 -0500503
Chuck Lever42ebfc22020-07-08 16:10:14 -0400504#define DEFINE_RPCB_ERROR_EVENT(name) \
505 DEFINE_EVENT(rpc_reply_event, rpcb_##name##_err, \
506 TP_PROTO( \
507 const struct rpc_task *task \
508 ), \
509 TP_ARGS(task))
510
511DEFINE_RPCB_ERROR_EVENT(prog_unavail);
512DEFINE_RPCB_ERROR_EVENT(timeout);
513DEFINE_RPCB_ERROR_EVENT(bind_version);
514DEFINE_RPCB_ERROR_EVENT(unreachable);
515DEFINE_RPCB_ERROR_EVENT(unrecognized);
516
Chuck Lever06e234c2020-07-08 16:09:11 -0400517TRACE_EVENT(rpc_buf_alloc,
518 TP_PROTO(
519 const struct rpc_task *task,
520 int status
521 ),
522
523 TP_ARGS(task, status),
524
525 TP_STRUCT__entry(
526 __field(unsigned int, task_id)
527 __field(unsigned int, client_id)
528 __field(size_t, callsize)
529 __field(size_t, recvsize)
530 __field(int, status)
531 ),
532
533 TP_fast_assign(
534 __entry->task_id = task->tk_pid;
535 __entry->client_id = task->tk_client->cl_clid;
536 __entry->callsize = task->tk_rqstp->rq_callsize;
537 __entry->recvsize = task->tk_rqstp->rq_rcvsize;
538 __entry->status = status;
539 ),
540
541 TP_printk("task:%u@%u callsize=%zu recvsize=%zu status=%d",
542 __entry->task_id, __entry->client_id,
543 __entry->callsize, __entry->recvsize, __entry->status
544 )
545);
546
Chuck Lever0125ecb2020-05-12 17:13:23 -0400547TRACE_EVENT(rpc_call_rpcerror,
548 TP_PROTO(
549 const struct rpc_task *task,
550 int tk_status,
551 int rpc_status
552 ),
553
554 TP_ARGS(task, tk_status, rpc_status),
555
556 TP_STRUCT__entry(
557 __field(unsigned int, task_id)
558 __field(unsigned int, client_id)
559 __field(int, tk_status)
560 __field(int, rpc_status)
561 ),
562
563 TP_fast_assign(
564 __entry->client_id = task->tk_client->cl_clid;
565 __entry->task_id = task->tk_pid;
566 __entry->tk_status = tk_status;
567 __entry->rpc_status = rpc_status;
568 ),
569
570 TP_printk("task:%u@%u tk_status=%d rpc_status=%d",
571 __entry->task_id, __entry->client_id,
572 __entry->tk_status, __entry->rpc_status)
573);
574
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400575TRACE_EVENT(rpc_stats_latency,
576
577 TP_PROTO(
578 const struct rpc_task *task,
579 ktime_t backlog,
580 ktime_t rtt,
581 ktime_t execute
582 ),
583
584 TP_ARGS(task, backlog, rtt, execute),
585
586 TP_STRUCT__entry(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400587 __field(unsigned int, task_id)
588 __field(unsigned int, client_id)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400589 __field(u32, xid)
590 __field(int, version)
591 __string(progname, task->tk_client->cl_program->name)
592 __string(procname, rpc_proc_name(task))
593 __field(unsigned long, backlog)
594 __field(unsigned long, rtt)
595 __field(unsigned long, execute)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400596 ),
597
598 TP_fast_assign(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400599 __entry->client_id = task->tk_client->cl_clid;
600 __entry->task_id = task->tk_pid;
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400601 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
602 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700603 __assign_str(progname, task->tk_client->cl_program->name);
604 __assign_str(procname, rpc_proc_name(task));
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400605 __entry->backlog = ktime_to_us(backlog);
606 __entry->rtt = ktime_to_us(rtt);
607 __entry->execute = ktime_to_us(execute);
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400608 ),
609
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400610 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
611 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400612 __get_str(progname), __entry->version, __get_str(procname),
613 __entry->backlog, __entry->rtt, __entry->execute)
614);
615
Chuck Lever55828632019-02-11 11:24:10 -0500616TRACE_EVENT(rpc_xdr_overflow,
617 TP_PROTO(
618 const struct xdr_stream *xdr,
619 size_t requested
620 ),
621
622 TP_ARGS(xdr, requested),
623
624 TP_STRUCT__entry(
625 __field(unsigned int, task_id)
626 __field(unsigned int, client_id)
627 __field(int, version)
628 __field(size_t, requested)
629 __field(const void *, end)
630 __field(const void *, p)
631 __field(const void *, head_base)
632 __field(size_t, head_len)
633 __field(const void *, tail_base)
634 __field(size_t, tail_len)
635 __field(unsigned int, page_len)
636 __field(unsigned int, len)
Chuck Leverd321ff52020-10-23 10:41:07 -0400637 __string(progname, xdr->rqst ?
638 xdr->rqst->rq_task->tk_client->cl_program->name : "unknown")
639 __string(procedure, xdr->rqst ?
640 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown")
Chuck Lever55828632019-02-11 11:24:10 -0500641 ),
642
643 TP_fast_assign(
644 if (xdr->rqst) {
645 const struct rpc_task *task = xdr->rqst->rq_task;
646
647 __entry->task_id = task->tk_pid;
648 __entry->client_id = task->tk_client->cl_clid;
649 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -0700650 task->tk_client->cl_program->name);
Chuck Lever55828632019-02-11 11:24:10 -0500651 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700652 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
Chuck Lever55828632019-02-11 11:24:10 -0500653 } else {
654 __entry->task_id = 0;
655 __entry->client_id = 0;
Joe Perches78c14b32021-06-12 08:42:27 -0700656 __assign_str(progname, "unknown");
Chuck Lever55828632019-02-11 11:24:10 -0500657 __entry->version = 0;
Joe Perches78c14b32021-06-12 08:42:27 -0700658 __assign_str(procedure, "unknown");
Chuck Lever55828632019-02-11 11:24:10 -0500659 }
660 __entry->requested = requested;
661 __entry->end = xdr->end;
662 __entry->p = xdr->p;
663 __entry->head_base = xdr->buf->head[0].iov_base,
664 __entry->head_len = xdr->buf->head[0].iov_len,
665 __entry->page_len = xdr->buf->page_len,
666 __entry->tail_base = xdr->buf->tail[0].iov_base,
667 __entry->tail_len = xdr->buf->tail[0].iov_len,
668 __entry->len = xdr->buf->len;
669 ),
670
671 TP_printk(
672 "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
673 __entry->task_id, __entry->client_id,
674 __get_str(progname), __entry->version, __get_str(procedure),
675 __entry->requested, __entry->p, __entry->end,
676 __entry->head_base, __entry->head_len,
677 __entry->page_len,
678 __entry->tail_base, __entry->tail_len,
679 __entry->len
680 )
681);
682
Chuck Lever7be9cea32019-02-11 11:24:16 -0500683TRACE_EVENT(rpc_xdr_alignment,
684 TP_PROTO(
685 const struct xdr_stream *xdr,
686 size_t offset,
687 unsigned int copied
688 ),
689
690 TP_ARGS(xdr, offset, copied),
691
692 TP_STRUCT__entry(
693 __field(unsigned int, task_id)
694 __field(unsigned int, client_id)
695 __field(int, version)
696 __field(size_t, offset)
697 __field(unsigned int, copied)
698 __field(const void *, head_base)
699 __field(size_t, head_len)
700 __field(const void *, tail_base)
701 __field(size_t, tail_len)
702 __field(unsigned int, page_len)
703 __field(unsigned int, len)
704 __string(progname,
705 xdr->rqst->rq_task->tk_client->cl_program->name)
706 __string(procedure,
707 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
708 ),
709
710 TP_fast_assign(
711 const struct rpc_task *task = xdr->rqst->rq_task;
712
713 __entry->task_id = task->tk_pid;
714 __entry->client_id = task->tk_client->cl_clid;
715 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -0700716 task->tk_client->cl_program->name);
Chuck Lever7be9cea32019-02-11 11:24:16 -0500717 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700718 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
Chuck Lever7be9cea32019-02-11 11:24:16 -0500719
720 __entry->offset = offset;
721 __entry->copied = copied;
722 __entry->head_base = xdr->buf->head[0].iov_base,
723 __entry->head_len = xdr->buf->head[0].iov_len,
724 __entry->page_len = xdr->buf->page_len,
725 __entry->tail_base = xdr->buf->tail[0].iov_base,
726 __entry->tail_len = xdr->buf->tail[0].iov_len,
727 __entry->len = xdr->buf->len;
728 ),
729
730 TP_printk(
731 "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
732 __entry->task_id, __entry->client_id,
733 __get_str(progname), __entry->version, __get_str(procedure),
734 __entry->offset, __entry->copied,
735 __entry->head_base, __entry->head_len,
736 __entry->page_len,
737 __entry->tail_base, __entry->tail_len,
738 __entry->len
739 )
740);
741
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400742/*
743 * First define the enums in the below macros to be exported to userspace
744 * via TRACE_DEFINE_ENUM().
745 */
746#undef EM
747#undef EMe
748#define EM(a, b) TRACE_DEFINE_ENUM(a);
749#define EMe(a, b) TRACE_DEFINE_ENUM(a);
750
751#define RPC_SHOW_SOCKET \
752 EM( SS_FREE, "FREE" ) \
753 EM( SS_UNCONNECTED, "UNCONNECTED" ) \
Chuck Lever82909dc2020-05-12 17:13:18 -0400754 EM( SS_CONNECTING, "CONNECTING" ) \
755 EM( SS_CONNECTED, "CONNECTED" ) \
756 EMe( SS_DISCONNECTING, "DISCONNECTING" )
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400757
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400758#define rpc_show_socket_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400759 __print_symbolic(state, RPC_SHOW_SOCKET)
760
761RPC_SHOW_SOCKET
762
763#define RPC_SHOW_SOCK \
764 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
765 EM( TCP_SYN_SENT, "SYN_SENT" ) \
766 EM( TCP_SYN_RECV, "SYN_RECV" ) \
767 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
768 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
769 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
770 EM( TCP_CLOSE, "CLOSE" ) \
771 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
772 EM( TCP_LAST_ACK, "LAST_ACK" ) \
773 EM( TCP_LISTEN, "LISTEN" ) \
774 EMe( TCP_CLOSING, "CLOSING" )
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400775
776#define rpc_show_sock_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400777 __print_symbolic(state, RPC_SHOW_SOCK)
778
779RPC_SHOW_SOCK
780
781/*
782 * Now redefine the EM() and EMe() macros to map the enums to the strings
783 * that will be printed in the output.
784 */
785#undef EM
786#undef EMe
787#define EM(a, b) {a, b},
788#define EMe(a, b) {a, b}
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400789
790DECLARE_EVENT_CLASS(xs_socket_event,
791
792 TP_PROTO(
793 struct rpc_xprt *xprt,
794 struct socket *socket
795 ),
796
797 TP_ARGS(xprt, socket),
798
799 TP_STRUCT__entry(
800 __field(unsigned int, socket_state)
801 __field(unsigned int, sock_state)
802 __field(unsigned long long, ino)
803 __string(dstaddr,
804 xprt->address_strings[RPC_DISPLAY_ADDR])
805 __string(dstport,
806 xprt->address_strings[RPC_DISPLAY_PORT])
807 ),
808
809 TP_fast_assign(
810 struct inode *inode = SOCK_INODE(socket);
811 __entry->socket_state = socket->state;
812 __entry->sock_state = socket->sk->sk_state;
813 __entry->ino = (unsigned long long)inode->i_ino;
814 __assign_str(dstaddr,
815 xprt->address_strings[RPC_DISPLAY_ADDR]);
816 __assign_str(dstport,
817 xprt->address_strings[RPC_DISPLAY_PORT]);
818 ),
819
820 TP_printk(
821 "socket:[%llu] dstaddr=%s/%s "
822 "state=%u (%s) sk_state=%u (%s)",
823 __entry->ino, __get_str(dstaddr), __get_str(dstport),
824 __entry->socket_state,
825 rpc_show_socket_state(__entry->socket_state),
826 __entry->sock_state,
827 rpc_show_sock_state(__entry->sock_state)
828 )
829);
830#define DEFINE_RPC_SOCKET_EVENT(name) \
831 DEFINE_EVENT(xs_socket_event, name, \
832 TP_PROTO( \
833 struct rpc_xprt *xprt, \
834 struct socket *socket \
835 ), \
836 TP_ARGS(xprt, socket))
837
838DECLARE_EVENT_CLASS(xs_socket_event_done,
839
840 TP_PROTO(
841 struct rpc_xprt *xprt,
842 struct socket *socket,
843 int error
844 ),
845
846 TP_ARGS(xprt, socket, error),
847
848 TP_STRUCT__entry(
849 __field(int, error)
850 __field(unsigned int, socket_state)
851 __field(unsigned int, sock_state)
852 __field(unsigned long long, ino)
853 __string(dstaddr,
854 xprt->address_strings[RPC_DISPLAY_ADDR])
855 __string(dstport,
856 xprt->address_strings[RPC_DISPLAY_PORT])
857 ),
858
859 TP_fast_assign(
860 struct inode *inode = SOCK_INODE(socket);
861 __entry->socket_state = socket->state;
862 __entry->sock_state = socket->sk->sk_state;
863 __entry->ino = (unsigned long long)inode->i_ino;
864 __entry->error = error;
865 __assign_str(dstaddr,
866 xprt->address_strings[RPC_DISPLAY_ADDR]);
867 __assign_str(dstport,
868 xprt->address_strings[RPC_DISPLAY_PORT]);
869 ),
870
871 TP_printk(
872 "error=%d socket:[%llu] dstaddr=%s/%s "
873 "state=%u (%s) sk_state=%u (%s)",
874 __entry->error,
875 __entry->ino, __get_str(dstaddr), __get_str(dstport),
876 __entry->socket_state,
877 rpc_show_socket_state(__entry->socket_state),
878 __entry->sock_state,
879 rpc_show_sock_state(__entry->sock_state)
880 )
881);
882#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
883 DEFINE_EVENT(xs_socket_event_done, name, \
884 TP_PROTO( \
885 struct rpc_xprt *xprt, \
886 struct socket *socket, \
887 int error \
888 ), \
889 TP_ARGS(xprt, socket, error))
890
891DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
892DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
Trond Myklebuste8353c762013-12-31 13:39:22 -0500893DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400894DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
895DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
896DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
897
Chuck Lever015747d2020-07-08 16:09:32 -0400898TRACE_EVENT(rpc_socket_nospace,
899 TP_PROTO(
900 const struct rpc_rqst *rqst,
901 const struct sock_xprt *transport
902 ),
903
904 TP_ARGS(rqst, transport),
905
906 TP_STRUCT__entry(
907 __field(unsigned int, task_id)
908 __field(unsigned int, client_id)
909 __field(unsigned int, total)
910 __field(unsigned int, remaining)
911 ),
912
913 TP_fast_assign(
914 __entry->task_id = rqst->rq_task->tk_pid;
915 __entry->client_id = rqst->rq_task->tk_client->cl_clid;
916 __entry->total = rqst->rq_slen;
917 __entry->remaining = rqst->rq_slen - transport->xmit.offset;
918 ),
919
920 TP_printk("task:%u@%u total=%u remaining=%u",
921 __entry->task_id, __entry->client_id,
922 __entry->total, __entry->remaining
923 )
924);
925
Chuck Lever94afd9c2020-05-18 10:13:02 -0400926#define rpc_show_xprt_state(x) \
927 __print_flags(x, "|", \
928 { (1UL << XPRT_LOCKED), "LOCKED"}, \
929 { (1UL << XPRT_CONNECTED), "CONNECTED"}, \
930 { (1UL << XPRT_CONNECTING), "CONNECTING"}, \
931 { (1UL << XPRT_CLOSE_WAIT), "CLOSE_WAIT"}, \
932 { (1UL << XPRT_BOUND), "BOUND"}, \
933 { (1UL << XPRT_BINDING), "BINDING"}, \
934 { (1UL << XPRT_CLOSING), "CLOSING"}, \
Chuck Leverf9d091c2021-07-19 10:48:22 -0400935 { (1UL << XPRT_OFFLINE), "OFFLINE"}, \
936 { (1UL << XPRT_REMOVE), "REMOVE"}, \
Chuck Lever94afd9c2020-05-18 10:13:02 -0400937 { (1UL << XPRT_CONGESTED), "CONGESTED"}, \
938 { (1UL << XPRT_CWND_WAIT), "CWND_WAIT"}, \
939 { (1UL << XPRT_WRITE_SPACE), "WRITE_SPACE"})
940
Chuck Lever911813d2020-05-12 17:13:34 -0400941DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class,
942 TP_PROTO(
943 const struct rpc_xprt *xprt
944 ),
945
946 TP_ARGS(xprt),
947
948 TP_STRUCT__entry(
Chuck Lever94afd9c2020-05-18 10:13:02 -0400949 __field(unsigned long, state)
Chuck Lever911813d2020-05-12 17:13:34 -0400950 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
951 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
952 ),
953
954 TP_fast_assign(
Chuck Lever94afd9c2020-05-18 10:13:02 -0400955 __entry->state = xprt->state;
Chuck Lever911813d2020-05-12 17:13:34 -0400956 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
957 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
958 ),
959
Chuck Lever94afd9c2020-05-18 10:13:02 -0400960 TP_printk("peer=[%s]:%s state=%s",
961 __get_str(addr), __get_str(port),
962 rpc_show_xprt_state(__entry->state))
Chuck Lever911813d2020-05-12 17:13:34 -0400963);
964
965#define DEFINE_RPC_XPRT_LIFETIME_EVENT(name) \
966 DEFINE_EVENT(rpc_xprt_lifetime_class, \
967 xprt_##name, \
968 TP_PROTO( \
969 const struct rpc_xprt *xprt \
970 ), \
971 TP_ARGS(xprt))
972
973DEFINE_RPC_XPRT_LIFETIME_EVENT(create);
Chuck Leverdb0a86c2020-07-08 16:09:47 -0400974DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);
Chuck Lever911813d2020-05-12 17:13:34 -0400975DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto);
976DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done);
977DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force);
978DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_cleanup);
979DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy);
980
Jeff Layton3705ad62014-10-28 14:24:13 -0400981DECLARE_EVENT_CLASS(rpc_xprt_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -0500982 TP_PROTO(
983 const struct rpc_xprt *xprt,
984 __be32 xid,
985 int status
986 ),
Jeff Layton3705ad62014-10-28 14:24:13 -0400987
988 TP_ARGS(xprt, xid, status),
989
990 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -0400991 __field(u32, xid)
Jeff Layton3705ad62014-10-28 14:24:13 -0400992 __field(int, status)
993 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
994 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
995 ),
996
997 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -0400998 __entry->xid = be32_to_cpu(xid);
Jeff Layton3705ad62014-10-28 14:24:13 -0400999 __entry->status = status;
1000 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1001 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1002 ),
1003
Chuck Levera30ccf12017-10-20 10:35:18 -04001004 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
1005 __get_str(port), __entry->xid,
Jeff Layton3705ad62014-10-28 14:24:13 -04001006 __entry->status)
1007);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001008#define DEFINE_RPC_XPRT_EVENT(name) \
1009 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
1010 TP_PROTO( \
1011 const struct rpc_xprt *xprt, \
1012 __be32 xid, \
1013 int status \
1014 ), \
1015 TP_ARGS(xprt, xid, status))
Jeff Layton3705ad62014-10-28 14:24:13 -04001016
Chuck Leverdc5820b2018-12-19 11:00:16 -05001017DEFINE_RPC_XPRT_EVENT(timer);
1018DEFINE_RPC_XPRT_EVENT(lookup_rqst);
Jeff Layton3705ad62014-10-28 14:24:13 -04001019
Chuck Lever0c776682019-02-11 11:25:04 -05001020TRACE_EVENT(xprt_transmit,
1021 TP_PROTO(
1022 const struct rpc_rqst *rqst,
1023 int status
1024 ),
1025
1026 TP_ARGS(rqst, status),
1027
1028 TP_STRUCT__entry(
1029 __field(unsigned int, task_id)
1030 __field(unsigned int, client_id)
1031 __field(u32, xid)
1032 __field(u32, seqno)
1033 __field(int, status)
1034 ),
1035
1036 TP_fast_assign(
1037 __entry->task_id = rqst->rq_task->tk_pid;
Olga Kornievskaiaf87b5432019-03-12 12:06:35 -04001038 __entry->client_id = rqst->rq_task->tk_client ?
1039 rqst->rq_task->tk_client->cl_clid : -1;
Chuck Lever0c776682019-02-11 11:25:04 -05001040 __entry->xid = be32_to_cpu(rqst->rq_xid);
1041 __entry->seqno = rqst->rq_seqno;
1042 __entry->status = status;
1043 ),
1044
1045 TP_printk(
1046 "task:%u@%u xid=0x%08x seqno=%u status=%d",
1047 __entry->task_id, __entry->client_id, __entry->xid,
1048 __entry->seqno, __entry->status)
1049);
1050
Chuck Levere936a592021-03-31 13:22:27 -04001051TRACE_EVENT(xprt_retransmit,
1052 TP_PROTO(
1053 const struct rpc_rqst *rqst
1054 ),
1055
1056 TP_ARGS(rqst),
1057
1058 TP_STRUCT__entry(
1059 __field(unsigned int, task_id)
1060 __field(unsigned int, client_id)
1061 __field(u32, xid)
1062 __field(int, ntrans)
1063 __field(int, version)
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001064 __field(unsigned long, timeout)
Chuck Levere936a592021-03-31 13:22:27 -04001065 __string(progname,
1066 rqst->rq_task->tk_client->cl_program->name)
Chuck Leverbe630b92021-07-19 10:48:28 -04001067 __string(procname, rpc_proc_name(rqst->rq_task))
Chuck Levere936a592021-03-31 13:22:27 -04001068 ),
1069
1070 TP_fast_assign(
1071 struct rpc_task *task = rqst->rq_task;
1072
1073 __entry->task_id = task->tk_pid;
1074 __entry->client_id = task->tk_client ?
1075 task->tk_client->cl_clid : -1;
1076 __entry->xid = be32_to_cpu(rqst->rq_xid);
1077 __entry->ntrans = rqst->rq_ntrans;
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001078 __entry->timeout = task->tk_timeout;
Chuck Levere936a592021-03-31 13:22:27 -04001079 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -07001080 task->tk_client->cl_program->name);
Chuck Levere936a592021-03-31 13:22:27 -04001081 __entry->version = task->tk_client->cl_vers;
Chuck Leverbe630b92021-07-19 10:48:28 -04001082 __assign_str(procname, rpc_proc_name(task));
Chuck Levere936a592021-03-31 13:22:27 -04001083 ),
1084
1085 TP_printk(
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001086 "task:%u@%u xid=0x%08x %sv%d %s ntrans=%d timeout=%lu",
Chuck Levere936a592021-03-31 13:22:27 -04001087 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Leverbe630b92021-07-19 10:48:28 -04001088 __get_str(progname), __entry->version, __get_str(procname),
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001089 __entry->ntrans, __entry->timeout
Chuck Leverbe630b92021-07-19 10:48:28 -04001090 )
Chuck Levere936a592021-03-31 13:22:27 -04001091);
1092
Chuck Levera25a4cb2018-03-16 10:33:55 -04001093TRACE_EVENT(xprt_ping,
1094 TP_PROTO(const struct rpc_xprt *xprt, int status),
1095
1096 TP_ARGS(xprt, status),
1097
1098 TP_STRUCT__entry(
1099 __field(int, status)
1100 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
1101 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
1102 ),
1103
1104 TP_fast_assign(
1105 __entry->status = status;
1106 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1107 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1108 ),
1109
1110 TP_printk("peer=[%s]:%s status=%d",
1111 __get_str(addr), __get_str(port), __entry->status)
1112);
1113
Chuck Leverbf7ca702019-10-09 12:58:14 -04001114DECLARE_EVENT_CLASS(xprt_writelock_event,
1115 TP_PROTO(
1116 const struct rpc_xprt *xprt, const struct rpc_task *task
1117 ),
1118
1119 TP_ARGS(xprt, task),
1120
1121 TP_STRUCT__entry(
1122 __field(unsigned int, task_id)
1123 __field(unsigned int, client_id)
1124 __field(unsigned int, snd_task_id)
1125 ),
1126
1127 TP_fast_assign(
1128 if (task) {
1129 __entry->task_id = task->tk_pid;
1130 __entry->client_id = task->tk_client ?
1131 task->tk_client->cl_clid : -1;
1132 } else {
1133 __entry->task_id = -1;
1134 __entry->client_id = -1;
1135 }
1136 __entry->snd_task_id = xprt->snd_task ?
1137 xprt->snd_task->tk_pid : -1;
1138 ),
1139
1140 TP_printk("task:%u@%u snd_task:%u",
1141 __entry->task_id, __entry->client_id,
1142 __entry->snd_task_id)
1143);
1144
1145#define DEFINE_WRITELOCK_EVENT(name) \
1146 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
1147 TP_PROTO( \
1148 const struct rpc_xprt *xprt, \
1149 const struct rpc_task *task \
1150 ), \
1151 TP_ARGS(xprt, task))
1152
1153DEFINE_WRITELOCK_EVENT(reserve_xprt);
1154DEFINE_WRITELOCK_EVENT(release_xprt);
1155
1156DECLARE_EVENT_CLASS(xprt_cong_event,
1157 TP_PROTO(
1158 const struct rpc_xprt *xprt, const struct rpc_task *task
1159 ),
1160
1161 TP_ARGS(xprt, task),
1162
1163 TP_STRUCT__entry(
1164 __field(unsigned int, task_id)
1165 __field(unsigned int, client_id)
1166 __field(unsigned int, snd_task_id)
1167 __field(unsigned long, cong)
1168 __field(unsigned long, cwnd)
1169 __field(bool, wait)
1170 ),
1171
1172 TP_fast_assign(
1173 if (task) {
1174 __entry->task_id = task->tk_pid;
1175 __entry->client_id = task->tk_client ?
1176 task->tk_client->cl_clid : -1;
1177 } else {
1178 __entry->task_id = -1;
1179 __entry->client_id = -1;
1180 }
1181 __entry->snd_task_id = xprt->snd_task ?
1182 xprt->snd_task->tk_pid : -1;
1183 __entry->cong = xprt->cong;
1184 __entry->cwnd = xprt->cwnd;
1185 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
1186 ),
1187
1188 TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s",
1189 __entry->task_id, __entry->client_id,
1190 __entry->snd_task_id, __entry->cong, __entry->cwnd,
1191 __entry->wait ? " (wait)" : "")
1192);
1193
1194#define DEFINE_CONG_EVENT(name) \
1195 DEFINE_EVENT(xprt_cong_event, xprt_##name, \
1196 TP_PROTO( \
1197 const struct rpc_xprt *xprt, \
1198 const struct rpc_task *task \
1199 ), \
1200 TP_ARGS(xprt, task))
1201
1202DEFINE_CONG_EVENT(reserve_cong);
1203DEFINE_CONG_EVENT(release_cong);
1204DEFINE_CONG_EVENT(get_cong);
1205DEFINE_CONG_EVENT(put_cong);
1206
Chuck Lever09d2ba02020-07-08 16:09:21 -04001207TRACE_EVENT(xprt_reserve,
1208 TP_PROTO(
1209 const struct rpc_rqst *rqst
1210 ),
1211
1212 TP_ARGS(rqst),
1213
1214 TP_STRUCT__entry(
1215 __field(unsigned int, task_id)
1216 __field(unsigned int, client_id)
1217 __field(u32, xid)
1218 ),
1219
1220 TP_fast_assign(
1221 __entry->task_id = rqst->rq_task->tk_pid;
1222 __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1223 __entry->xid = be32_to_cpu(rqst->rq_xid);
1224 ),
1225
1226 TP_printk("task:%u@%u xid=0x%08x",
1227 __entry->task_id, __entry->client_id, __entry->xid
1228 )
1229);
1230
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001231TRACE_EVENT(xs_stream_read_data,
1232 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
Jeff Layton3705ad62014-10-28 14:24:13 -04001233
1234 TP_ARGS(xprt, err, total),
1235
1236 TP_STRUCT__entry(
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001237 __field(ssize_t, err)
1238 __field(size_t, total)
Jeff Layton3705ad62014-10-28 14:24:13 -04001239 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
1240 "(null)")
1241 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
1242 "(null)")
1243 ),
1244
1245 TP_fast_assign(
1246 __entry->err = err;
1247 __entry->total = total;
1248 __assign_str(addr, xprt ?
1249 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
1250 __assign_str(port, xprt ?
1251 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
1252 ),
1253
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001254 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
Jeff Layton3705ad62014-10-28 14:24:13 -04001255 __get_str(port), __entry->err, __entry->total)
1256);
1257
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001258TRACE_EVENT(xs_stream_read_request,
Jeff Layton1a867a02014-10-28 14:24:14 -04001259 TP_PROTO(struct sock_xprt *xs),
1260
1261 TP_ARGS(xs),
1262
1263 TP_STRUCT__entry(
1264 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
1265 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
Chuck Levera30ccf12017-10-20 10:35:18 -04001266 __field(u32, xid)
Jeff Layton1a867a02014-10-28 14:24:14 -04001267 __field(unsigned long, copied)
1268 __field(unsigned int, reclen)
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001269 __field(unsigned int, offset)
Jeff Layton1a867a02014-10-28 14:24:14 -04001270 ),
1271
1272 TP_fast_assign(
1273 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
1274 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
Trond Myklebustd1109aa2018-08-13 15:48:42 -04001275 __entry->xid = be32_to_cpu(xs->recv.xid);
Trond Myklebustd1109aa2018-08-13 15:48:42 -04001276 __entry->copied = xs->recv.copied;
1277 __entry->reclen = xs->recv.len;
1278 __entry->offset = xs->recv.offset;
Jeff Layton1a867a02014-10-28 14:24:14 -04001279 ),
1280
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001281 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
Chuck Levera30ccf12017-10-20 10:35:18 -04001282 __get_str(addr), __get_str(port), __entry->xid,
Jeff Layton1a867a02014-10-28 14:24:14 -04001283 __entry->copied, __entry->reclen, __entry->offset)
1284);
1285
Chuck Levere465cc32020-07-08 16:10:19 -04001286TRACE_EVENT(rpcb_getport,
1287 TP_PROTO(
1288 const struct rpc_clnt *clnt,
1289 const struct rpc_task *task,
1290 unsigned int bind_version
1291 ),
1292
1293 TP_ARGS(clnt, task, bind_version),
1294
1295 TP_STRUCT__entry(
1296 __field(unsigned int, task_id)
1297 __field(unsigned int, client_id)
1298 __field(unsigned int, program)
1299 __field(unsigned int, version)
1300 __field(int, protocol)
1301 __field(unsigned int, bind_version)
1302 __string(servername, task->tk_xprt->servername)
1303 ),
1304
1305 TP_fast_assign(
1306 __entry->task_id = task->tk_pid;
1307 __entry->client_id = clnt->cl_clid;
1308 __entry->program = clnt->cl_prog;
1309 __entry->version = clnt->cl_vers;
1310 __entry->protocol = task->tk_xprt->prot;
1311 __entry->bind_version = bind_version;
1312 __assign_str(servername, task->tk_xprt->servername);
1313 ),
1314
1315 TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u",
1316 __entry->task_id, __entry->client_id, __get_str(servername),
1317 __entry->program, __entry->version, __entry->protocol,
1318 __entry->bind_version
1319 )
1320);
Chuck Leverc509f15a2020-05-12 17:13:28 -04001321
Chuck Leverac1ae532020-07-08 16:10:24 -04001322TRACE_EVENT(rpcb_setport,
1323 TP_PROTO(
1324 const struct rpc_task *task,
1325 int status,
1326 unsigned short port
1327 ),
1328
1329 TP_ARGS(task, status, port),
1330
1331 TP_STRUCT__entry(
1332 __field(unsigned int, task_id)
1333 __field(unsigned int, client_id)
1334 __field(int, status)
1335 __field(unsigned short, port)
1336 ),
1337
1338 TP_fast_assign(
1339 __entry->task_id = task->tk_pid;
1340 __entry->client_id = task->tk_client->cl_clid;
1341 __entry->status = status;
1342 __entry->port = port;
1343 ),
1344
1345 TP_printk("task:%u@%u status=%d port=%u",
1346 __entry->task_id, __entry->client_id,
1347 __entry->status, __entry->port
1348 )
1349);
1350
Chuck Leverc3adcc72020-07-08 16:10:40 -04001351TRACE_EVENT(pmap_register,
1352 TP_PROTO(
1353 u32 program,
1354 u32 version,
1355 int protocol,
1356 unsigned short port
1357 ),
1358
1359 TP_ARGS(program, version, protocol, port),
1360
1361 TP_STRUCT__entry(
1362 __field(unsigned int, program)
1363 __field(unsigned int, version)
1364 __field(int, protocol)
1365 __field(unsigned int, port)
1366 ),
1367
1368 TP_fast_assign(
1369 __entry->program = program;
1370 __entry->version = version;
1371 __entry->protocol = protocol;
1372 __entry->port = port;
1373 ),
1374
1375 TP_printk("program=%u version=%u protocol=%d port=%u",
1376 __entry->program, __entry->version,
1377 __entry->protocol, __entry->port
1378 )
1379);
1380
1381TRACE_EVENT(rpcb_register,
1382 TP_PROTO(
1383 u32 program,
1384 u32 version,
1385 const char *addr,
1386 const char *netid
1387 ),
1388
1389 TP_ARGS(program, version, addr, netid),
1390
1391 TP_STRUCT__entry(
1392 __field(unsigned int, program)
1393 __field(unsigned int, version)
1394 __string(addr, addr)
1395 __string(netid, netid)
1396 ),
1397
1398 TP_fast_assign(
1399 __entry->program = program;
1400 __entry->version = version;
1401 __assign_str(addr, addr);
1402 __assign_str(netid, netid);
1403 ),
1404
1405 TP_printk("program=%u version=%u addr=%s netid=%s",
1406 __entry->program, __entry->version,
1407 __get_str(addr), __get_str(netid)
1408 )
1409);
1410
1411TRACE_EVENT(rpcb_unregister,
1412 TP_PROTO(
1413 u32 program,
1414 u32 version,
1415 const char *netid
1416 ),
1417
1418 TP_ARGS(program, version, netid),
1419
1420 TP_STRUCT__entry(
1421 __field(unsigned int, program)
1422 __field(unsigned int, version)
1423 __string(netid, netid)
1424 ),
1425
1426 TP_fast_assign(
1427 __entry->program = program;
1428 __entry->version = version;
1429 __assign_str(netid, netid);
1430 ),
1431
1432 TP_printk("program=%u version=%u netid=%s",
1433 __entry->program, __entry->version, __get_str(netid)
1434 )
1435);
1436
Chuck Lever5f39d272021-01-03 14:39:27 -05001437/* Record an xdr_buf containing a fully-formed RPC message */
1438DECLARE_EVENT_CLASS(svc_xdr_msg_class,
Chuck Leverc509f15a2020-05-12 17:13:28 -04001439 TP_PROTO(
Chuck Leverc509f15a2020-05-12 17:13:28 -04001440 const struct xdr_buf *xdr
1441 ),
1442
Chuck Lever5f39d272021-01-03 14:39:27 -05001443 TP_ARGS(xdr),
Chuck Leverc509f15a2020-05-12 17:13:28 -04001444
1445 TP_STRUCT__entry(
1446 __field(u32, xid)
1447 __field(const void *, head_base)
1448 __field(size_t, head_len)
1449 __field(const void *, tail_base)
1450 __field(size_t, tail_len)
1451 __field(unsigned int, page_len)
1452 __field(unsigned int, msg_len)
1453 ),
1454
1455 TP_fast_assign(
Chuck Lever5f39d272021-01-03 14:39:27 -05001456 __be32 *p = (__be32 *)xdr->head[0].iov_base;
1457
1458 __entry->xid = be32_to_cpu(*p);
1459 __entry->head_base = p;
1460 __entry->head_len = xdr->head[0].iov_len;
1461 __entry->tail_base = xdr->tail[0].iov_base;
1462 __entry->tail_len = xdr->tail[0].iov_len;
1463 __entry->page_len = xdr->page_len;
1464 __entry->msg_len = xdr->len;
1465 ),
1466
1467 TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
1468 __entry->xid,
1469 __entry->head_base, __entry->head_len, __entry->page_len,
1470 __entry->tail_base, __entry->tail_len, __entry->msg_len
1471 )
1472);
1473
1474#define DEFINE_SVCXDRMSG_EVENT(name) \
1475 DEFINE_EVENT(svc_xdr_msg_class, \
1476 svc_xdr_##name, \
1477 TP_PROTO( \
1478 const struct xdr_buf *xdr \
1479 ), \
1480 TP_ARGS(xdr))
1481
1482DEFINE_SVCXDRMSG_EVENT(recvfrom);
1483
1484/* Record an xdr_buf containing arbitrary data, tagged with an XID */
1485DECLARE_EVENT_CLASS(svc_xdr_buf_class,
1486 TP_PROTO(
1487 __be32 xid,
1488 const struct xdr_buf *xdr
1489 ),
1490
1491 TP_ARGS(xid, xdr),
1492
1493 TP_STRUCT__entry(
1494 __field(u32, xid)
1495 __field(const void *, head_base)
1496 __field(size_t, head_len)
1497 __field(const void *, tail_base)
1498 __field(size_t, tail_len)
1499 __field(unsigned int, page_len)
1500 __field(unsigned int, msg_len)
1501 ),
1502
1503 TP_fast_assign(
1504 __entry->xid = be32_to_cpu(xid);
Chuck Leverc509f15a2020-05-12 17:13:28 -04001505 __entry->head_base = xdr->head[0].iov_base;
1506 __entry->head_len = xdr->head[0].iov_len;
1507 __entry->tail_base = xdr->tail[0].iov_base;
1508 __entry->tail_len = xdr->tail[0].iov_len;
1509 __entry->page_len = xdr->page_len;
1510 __entry->msg_len = xdr->len;
1511 ),
1512
1513 TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
1514 __entry->xid,
1515 __entry->head_base, __entry->head_len, __entry->page_len,
1516 __entry->tail_base, __entry->tail_len, __entry->msg_len
1517 )
1518);
1519
1520#define DEFINE_SVCXDRBUF_EVENT(name) \
1521 DEFINE_EVENT(svc_xdr_buf_class, \
1522 svc_xdr_##name, \
1523 TP_PROTO( \
Chuck Lever5f39d272021-01-03 14:39:27 -05001524 __be32 xid, \
Chuck Leverc509f15a2020-05-12 17:13:28 -04001525 const struct xdr_buf *xdr \
1526 ), \
Chuck Lever5f39d272021-01-03 14:39:27 -05001527 TP_ARGS(xid, xdr))
Chuck Leverc509f15a2020-05-12 17:13:28 -04001528
Chuck Leverc509f15a2020-05-12 17:13:28 -04001529DEFINE_SVCXDRBUF_EVENT(sendto);
1530
Chuck Levera68d5a502020-07-24 15:26:47 -04001531/*
1532 * from include/linux/sunrpc/svc.h
1533 */
1534#define SVC_RQST_FLAG_LIST \
1535 svc_rqst_flag(SECURE) \
1536 svc_rqst_flag(LOCAL) \
1537 svc_rqst_flag(USEDEFERRAL) \
1538 svc_rqst_flag(DROPME) \
1539 svc_rqst_flag(SPLICE_OK) \
1540 svc_rqst_flag(VICTIM) \
1541 svc_rqst_flag(BUSY) \
Chuck Lever9082e1d2021-07-15 15:52:19 -04001542 svc_rqst_flag_end(DATA)
Chuck Levera68d5a502020-07-24 15:26:47 -04001543
1544#undef svc_rqst_flag
1545#undef svc_rqst_flag_end
1546#define svc_rqst_flag(x) TRACE_DEFINE_ENUM(RQ_##x);
1547#define svc_rqst_flag_end(x) TRACE_DEFINE_ENUM(RQ_##x);
1548
1549SVC_RQST_FLAG_LIST
1550
1551#undef svc_rqst_flag
1552#undef svc_rqst_flag_end
1553#define svc_rqst_flag(x) { BIT(RQ_##x), #x },
1554#define svc_rqst_flag_end(x) { BIT(RQ_##x), #x }
1555
Jeff Layton30660e04b2014-11-19 07:51:16 -05001556#define show_rqstp_flags(flags) \
Chuck Levera68d5a502020-07-24 15:26:47 -04001557 __print_flags(flags, "|", SVC_RQST_FLAG_LIST)
Jeff Layton4d152e22014-11-19 07:51:14 -05001558
Chuck Leverd88ff952020-04-15 09:47:41 -04001559TRACE_DEFINE_ENUM(SVC_GARBAGE);
1560TRACE_DEFINE_ENUM(SVC_SYSERR);
1561TRACE_DEFINE_ENUM(SVC_VALID);
1562TRACE_DEFINE_ENUM(SVC_NEGATIVE);
1563TRACE_DEFINE_ENUM(SVC_OK);
1564TRACE_DEFINE_ENUM(SVC_DROP);
1565TRACE_DEFINE_ENUM(SVC_CLOSE);
1566TRACE_DEFINE_ENUM(SVC_DENIED);
1567TRACE_DEFINE_ENUM(SVC_PENDING);
1568TRACE_DEFINE_ENUM(SVC_COMPLETE);
1569
Chuck Leverff27e9f2019-10-24 09:34:10 -04001570#define svc_show_status(status) \
1571 __print_symbolic(status, \
1572 { SVC_GARBAGE, "SVC_GARBAGE" }, \
1573 { SVC_SYSERR, "SVC_SYSERR" }, \
1574 { SVC_VALID, "SVC_VALID" }, \
1575 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \
1576 { SVC_OK, "SVC_OK" }, \
1577 { SVC_DROP, "SVC_DROP" }, \
1578 { SVC_CLOSE, "SVC_CLOSE" }, \
1579 { SVC_DENIED, "SVC_DENIED" }, \
1580 { SVC_PENDING, "SVC_PENDING" }, \
1581 { SVC_COMPLETE, "SVC_COMPLETE" })
1582
1583TRACE_EVENT(svc_authenticate,
Chuck Lever438623a2021-07-15 15:52:06 -04001584 TP_PROTO(const struct svc_rqst *rqst, int auth_res),
Chuck Leverff27e9f2019-10-24 09:34:10 -04001585
Chuck Lever438623a2021-07-15 15:52:06 -04001586 TP_ARGS(rqst, auth_res),
Chuck Leverff27e9f2019-10-24 09:34:10 -04001587
1588 TP_STRUCT__entry(
1589 __field(u32, xid)
1590 __field(unsigned long, svc_status)
1591 __field(unsigned long, auth_stat)
1592 ),
1593
1594 TP_fast_assign(
1595 __entry->xid = be32_to_cpu(rqst->rq_xid);
1596 __entry->svc_status = auth_res;
Chuck Lever438623a2021-07-15 15:52:06 -04001597 __entry->auth_stat = be32_to_cpu(rqst->rq_auth_stat);
Chuck Leverff27e9f2019-10-24 09:34:10 -04001598 ),
1599
1600 TP_printk("xid=0x%08x auth_res=%s auth_stat=%s",
1601 __entry->xid, svc_show_status(__entry->svc_status),
1602 rpc_show_auth_stat(__entry->auth_stat))
1603);
1604
Chuck Lever0b9547b2018-03-27 10:51:22 -04001605TRACE_EVENT(svc_process,
1606 TP_PROTO(const struct svc_rqst *rqst, const char *name),
1607
1608 TP_ARGS(rqst, name),
1609
1610 TP_STRUCT__entry(
1611 __field(u32, xid)
1612 __field(u32, vers)
1613 __field(u32, proc)
1614 __string(service, name)
Chuck Lever5c117202021-08-05 15:11:24 -04001615 __string(procedure, svc_proc_name(rqst))
Vasily Averind4b09ac2018-12-24 14:44:52 +03001616 __string(addr, rqst->rq_xprt ?
1617 rqst->rq_xprt->xpt_remotebuf : "(null)")
Chuck Lever0b9547b2018-03-27 10:51:22 -04001618 ),
1619
1620 TP_fast_assign(
1621 __entry->xid = be32_to_cpu(rqst->rq_xid);
1622 __entry->vers = rqst->rq_vers;
1623 __entry->proc = rqst->rq_proc;
1624 __assign_str(service, name);
Chuck Lever5c117202021-08-05 15:11:24 -04001625 __assign_str(procedure, svc_proc_name(rqst));
Vasily Averind4b09ac2018-12-24 14:44:52 +03001626 __assign_str(addr, rqst->rq_xprt ?
1627 rqst->rq_xprt->xpt_remotebuf : "(null)");
Chuck Lever0b9547b2018-03-27 10:51:22 -04001628 ),
1629
Chuck Lever89ff8742020-12-03 10:22:09 -05001630 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%s",
Chuck Lever0b9547b2018-03-27 10:51:22 -04001631 __get_str(addr), __entry->xid,
Chuck Lever89ff8742020-12-03 10:22:09 -05001632 __get_str(service), __entry->vers,
1633 __get_str(procedure)
1634 )
Chuck Lever0b9547b2018-03-27 10:51:22 -04001635);
1636
Trond Myklebust104f6352016-06-24 10:55:46 -04001637DECLARE_EVENT_CLASS(svc_rqst_event,
1638
Chuck Leverdc5820b2018-12-19 11:00:16 -05001639 TP_PROTO(
1640 const struct svc_rqst *rqst
1641 ),
Trond Myklebust104f6352016-06-24 10:55:46 -04001642
1643 TP_ARGS(rqst),
1644
1645 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -04001646 __field(u32, xid)
Trond Myklebust104f6352016-06-24 10:55:46 -04001647 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001648 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -04001649 ),
1650
1651 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -04001652 __entry->xid = be32_to_cpu(rqst->rq_xid);
Trond Myklebust104f6352016-06-24 10:55:46 -04001653 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001654 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -04001655 ),
1656
Chuck Leverece200d2018-03-27 10:51:00 -04001657 TP_printk("addr=%s xid=0x%08x flags=%s",
1658 __get_str(addr), __entry->xid,
1659 show_rqstp_flags(__entry->flags))
Trond Myklebust104f6352016-06-24 10:55:46 -04001660);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001661#define DEFINE_SVC_RQST_EVENT(name) \
1662 DEFINE_EVENT(svc_rqst_event, svc_##name, \
1663 TP_PROTO( \
1664 const struct svc_rqst *rqst \
1665 ), \
1666 TP_ARGS(rqst))
Trond Myklebust104f6352016-06-24 10:55:46 -04001667
Chuck Leverdc5820b2018-12-19 11:00:16 -05001668DEFINE_SVC_RQST_EVENT(defer);
1669DEFINE_SVC_RQST_EVENT(drop);
Trond Myklebust104f6352016-06-24 10:55:46 -04001670
Jeff Layton860a0d92014-10-28 14:24:12 -04001671DECLARE_EVENT_CLASS(svc_rqst_status,
1672
1673 TP_PROTO(struct svc_rqst *rqst, int status),
1674
1675 TP_ARGS(rqst, status),
1676
1677 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -04001678 __field(u32, xid)
Jeff Layton860a0d92014-10-28 14:24:12 -04001679 __field(int, status)
Jeff Layton4d152e22014-11-19 07:51:14 -05001680 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001681 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Jeff Layton860a0d92014-10-28 14:24:12 -04001682 ),
1683
1684 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -04001685 __entry->xid = be32_to_cpu(rqst->rq_xid);
Jeff Layton860a0d92014-10-28 14:24:12 -04001686 __entry->status = status;
Jeff Layton4d152e22014-11-19 07:51:14 -05001687 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001688 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Jeff Layton860a0d92014-10-28 14:24:12 -04001689 ),
1690
Chuck Leverece200d2018-03-27 10:51:00 -04001691 TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
1692 __get_str(addr), __entry->xid,
1693 __entry->status, show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -04001694);
1695
Jeff Layton860a0d92014-10-28 14:24:12 -04001696DEFINE_EVENT(svc_rqst_status, svc_send,
1697 TP_PROTO(struct svc_rqst *rqst, int status),
1698 TP_ARGS(rqst, status));
1699
Jeff Layton83a712e2014-11-21 14:19:31 -05001700#define show_svc_xprt_flags(flags) \
1701 __print_flags(flags, "|", \
1702 { (1UL << XPT_BUSY), "XPT_BUSY"}, \
1703 { (1UL << XPT_CONN), "XPT_CONN"}, \
1704 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \
1705 { (1UL << XPT_DATA), "XPT_DATA"}, \
1706 { (1UL << XPT_TEMP), "XPT_TEMP"}, \
1707 { (1UL << XPT_DEAD), "XPT_DEAD"}, \
1708 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \
1709 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \
1710 { (1UL << XPT_OLD), "XPT_OLD"}, \
1711 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \
1712 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \
Chuck Lever03edb902018-03-27 10:49:53 -04001713 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \
1714 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \
1715 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"})
Jeff Layton83a712e2014-11-21 14:19:31 -05001716
Chuck Lever4b8f3802020-04-28 17:13:32 -04001717TRACE_EVENT(svc_xprt_create_err,
1718 TP_PROTO(
1719 const char *program,
1720 const char *protocol,
1721 struct sockaddr *sap,
1722 const struct svc_xprt *xprt
1723 ),
1724
1725 TP_ARGS(program, protocol, sap, xprt),
1726
1727 TP_STRUCT__entry(
1728 __field(long, error)
1729 __string(program, program)
1730 __string(protocol, protocol)
1731 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1732 ),
1733
1734 TP_fast_assign(
1735 __entry->error = PTR_ERR(xprt);
1736 __assign_str(program, program);
1737 __assign_str(protocol, protocol);
1738 memcpy(__entry->addr, sap, sizeof(__entry->addr));
1739 ),
1740
1741 TP_printk("addr=%pISpc program=%s protocol=%s error=%ld",
1742 __entry->addr, __get_str(program), __get_str(protocol),
1743 __entry->error)
1744);
1745
Jeff Layton83a712e2014-11-21 14:19:31 -05001746TRACE_EVENT(svc_xprt_do_enqueue,
1747 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
1748
1749 TP_ARGS(xprt, rqst),
1750
1751 TP_STRUCT__entry(
Pratyush Anand051ac382015-08-27 10:01:33 +05301752 __field(int, pid)
1753 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001754 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -05001755 ),
1756
1757 TP_fast_assign(
Pratyush Anand051ac382015-08-27 10:01:33 +05301758 __entry->pid = rqst? rqst->rq_task->pid : 0;
Chuck Leverece200d2018-03-27 10:51:00 -04001759 __entry->flags = xprt->xpt_flags;
1760 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -05001761 ),
1762
Chuck Levere3e67622020-04-28 17:38:13 -04001763 TP_printk("addr=%s pid=%d flags=%s", __get_str(addr),
1764 __entry->pid, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -05001765);
1766
Trond Myklebust82ea2d72016-06-24 10:55:45 -04001767DECLARE_EVENT_CLASS(svc_xprt_event,
Jeff Layton83a712e2014-11-21 14:19:31 -05001768 TP_PROTO(struct svc_xprt *xprt),
1769
1770 TP_ARGS(xprt),
1771
1772 TP_STRUCT__entry(
Jeff Layton83a712e2014-11-21 14:19:31 -05001773 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001774 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -05001775 ),
1776
1777 TP_fast_assign(
Chuck Levercaa3e106d2018-03-27 10:50:07 -04001778 __entry->flags = xprt->xpt_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001779 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -05001780 ),
1781
Chuck Levere3e67622020-04-28 17:38:13 -04001782 TP_printk("addr=%s flags=%s", __get_str(addr),
1783 show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -05001784);
1785
Chuck Lever11bbb0f2020-03-17 17:41:43 -04001786#define DEFINE_SVC_XPRT_EVENT(name) \
1787 DEFINE_EVENT(svc_xprt_event, svc_xprt_##name, \
1788 TP_PROTO( \
1789 struct svc_xprt *xprt \
1790 ), \
1791 TP_ARGS(xprt))
1792
Chuck Lever7dcfbd82021-01-29 13:04:04 -05001793DEFINE_SVC_XPRT_EVENT(received);
Chuck Lever11bbb0f2020-03-17 17:41:43 -04001794DEFINE_SVC_XPRT_EVENT(no_write_space);
1795DEFINE_SVC_XPRT_EVENT(close);
1796DEFINE_SVC_XPRT_EVENT(detach);
1797DEFINE_SVC_XPRT_EVENT(free);
1798
1799TRACE_EVENT(svc_xprt_accept,
1800 TP_PROTO(
1801 const struct svc_xprt *xprt,
1802 const char *service
1803 ),
1804
1805 TP_ARGS(xprt, service),
1806
1807 TP_STRUCT__entry(
1808 __string(addr, xprt->xpt_remotebuf)
1809 __string(protocol, xprt->xpt_class->xcl_name)
1810 __string(service, service)
1811 ),
1812
1813 TP_fast_assign(
1814 __assign_str(addr, xprt->xpt_remotebuf);
Joe Perches78c14b32021-06-12 08:42:27 -07001815 __assign_str(protocol, xprt->xpt_class->xcl_name);
Chuck Lever11bbb0f2020-03-17 17:41:43 -04001816 __assign_str(service, service);
1817 ),
1818
1819 TP_printk("addr=%s protocol=%s service=%s",
1820 __get_str(addr), __get_str(protocol), __get_str(service)
1821 )
1822);
Trond Myklebust82ea2d72016-06-24 10:55:45 -04001823
Chuck Lever55f50882018-03-27 10:52:27 -04001824TRACE_EVENT(svc_xprt_dequeue,
1825 TP_PROTO(struct svc_rqst *rqst),
1826
1827 TP_ARGS(rqst),
1828
1829 TP_STRUCT__entry(
Chuck Lever55f50882018-03-27 10:52:27 -04001830 __field(unsigned long, flags)
1831 __field(unsigned long, wakeup)
1832 __string(addr, rqst->rq_xprt->xpt_remotebuf)
1833 ),
1834
1835 TP_fast_assign(
Chuck Lever55f50882018-03-27 10:52:27 -04001836 __entry->flags = rqst->rq_xprt->xpt_flags;
1837 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
1838 rqst->rq_qtime));
1839 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1840 ),
1841
Chuck Levere3e67622020-04-28 17:38:13 -04001842 TP_printk("addr=%s flags=%s wakeup-us=%lu", __get_str(addr),
1843 show_svc_xprt_flags(__entry->flags), __entry->wakeup)
Chuck Lever55f50882018-03-27 10:52:27 -04001844);
1845
Jeff Layton83a712e2014-11-21 14:19:31 -05001846TRACE_EVENT(svc_wake_up,
1847 TP_PROTO(int pid),
1848
1849 TP_ARGS(pid),
1850
1851 TP_STRUCT__entry(
1852 __field(int, pid)
1853 ),
1854
1855 TP_fast_assign(
1856 __entry->pid = pid;
1857 ),
1858
1859 TP_printk("pid=%d", __entry->pid)
1860);
1861
Chuck Lever22a027e82021-10-04 10:16:26 -04001862TRACE_EVENT(svc_alloc_arg_err,
1863 TP_PROTO(
1864 unsigned int pages
1865 ),
1866
1867 TP_ARGS(pages),
1868
1869 TP_STRUCT__entry(
1870 __field(unsigned int, pages)
1871 ),
1872
1873 TP_fast_assign(
1874 __entry->pages = pages;
1875 ),
1876
1877 TP_printk("pages=%u", __entry->pages)
1878);
1879
Jeff Layton83a712e2014-11-21 14:19:31 -05001880TRACE_EVENT(svc_handle_xprt,
1881 TP_PROTO(struct svc_xprt *xprt, int len),
1882
1883 TP_ARGS(xprt, len),
1884
1885 TP_STRUCT__entry(
Jeff Layton83a712e2014-11-21 14:19:31 -05001886 __field(int, len)
Pratyush Anand051ac382015-08-27 10:01:33 +05301887 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001888 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -05001889 ),
1890
1891 TP_fast_assign(
Jeff Layton83a712e2014-11-21 14:19:31 -05001892 __entry->len = len;
Chuck Leverece200d2018-03-27 10:51:00 -04001893 __entry->flags = xprt->xpt_flags;
1894 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -05001895 ),
1896
Chuck Levere3e67622020-04-28 17:38:13 -04001897 TP_printk("addr=%s len=%d flags=%s", __get_str(addr),
Pratyush Anand051ac382015-08-27 10:01:33 +05301898 __entry->len, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -05001899);
Trond Myklebust104f6352016-06-24 10:55:46 -04001900
Chuck Leveraaba72c2018-03-27 10:51:39 -04001901TRACE_EVENT(svc_stats_latency,
1902 TP_PROTO(const struct svc_rqst *rqst),
1903
1904 TP_ARGS(rqst),
1905
1906 TP_STRUCT__entry(
1907 __field(u32, xid)
1908 __field(unsigned long, execute)
Chuck Lever5c117202021-08-05 15:11:24 -04001909 __string(procedure, svc_proc_name(rqst))
Chuck Leveraaba72c2018-03-27 10:51:39 -04001910 __string(addr, rqst->rq_xprt->xpt_remotebuf)
1911 ),
1912
1913 TP_fast_assign(
1914 __entry->xid = be32_to_cpu(rqst->rq_xid);
1915 __entry->execute = ktime_to_us(ktime_sub(ktime_get(),
1916 rqst->rq_stime));
Chuck Lever5c117202021-08-05 15:11:24 -04001917 __assign_str(procedure, svc_proc_name(rqst));
Chuck Leveraaba72c2018-03-27 10:51:39 -04001918 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1919 ),
1920
Chuck Lever89ff8742020-12-03 10:22:09 -05001921 TP_printk("addr=%s xid=0x%08x proc=%s execute-us=%lu",
1922 __get_str(addr), __entry->xid, __get_str(procedure),
1923 __entry->execute)
Chuck Leveraaba72c2018-03-27 10:51:39 -04001924);
Trond Myklebust104f6352016-06-24 10:55:46 -04001925
1926DECLARE_EVENT_CLASS(svc_deferred_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -05001927 TP_PROTO(
1928 const struct svc_deferred_req *dr
1929 ),
Trond Myklebust104f6352016-06-24 10:55:46 -04001930
1931 TP_ARGS(dr),
1932
1933 TP_STRUCT__entry(
Chuck Lever8954c5c2020-04-15 09:05:26 -04001934 __field(const void *, dr)
Chuck Levera30ccf12017-10-20 10:35:18 -04001935 __field(u32, xid)
Chuck Leverece200d2018-03-27 10:51:00 -04001936 __string(addr, dr->xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -04001937 ),
1938
1939 TP_fast_assign(
Chuck Lever8954c5c2020-04-15 09:05:26 -04001940 __entry->dr = dr;
Chuck Levera30ccf12017-10-20 10:35:18 -04001941 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
1942 (dr->xprt_hlen>>2)));
Chuck Leverece200d2018-03-27 10:51:00 -04001943 __assign_str(addr, dr->xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -04001944 ),
1945
Chuck Lever8954c5c2020-04-15 09:05:26 -04001946 TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr,
1947 __entry->xid)
Trond Myklebust104f6352016-06-24 10:55:46 -04001948);
Chuck Lever8954c5c2020-04-15 09:05:26 -04001949
Chuck Leverdc5820b2018-12-19 11:00:16 -05001950#define DEFINE_SVC_DEFERRED_EVENT(name) \
Chuck Lever8954c5c2020-04-15 09:05:26 -04001951 DEFINE_EVENT(svc_deferred_event, svc_defer_##name, \
Chuck Leverdc5820b2018-12-19 11:00:16 -05001952 TP_PROTO( \
1953 const struct svc_deferred_req *dr \
1954 ), \
1955 TP_ARGS(dr))
Trond Myklebust104f6352016-06-24 10:55:46 -04001956
Chuck Leverdc5820b2018-12-19 11:00:16 -05001957DEFINE_SVC_DEFERRED_EVENT(drop);
Chuck Lever8954c5c2020-04-15 09:05:26 -04001958DEFINE_SVC_DEFERRED_EVENT(queue);
1959DEFINE_SVC_DEFERRED_EVENT(recv);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001960
Chuck Lever998024d2020-03-17 15:06:31 -04001961TRACE_EVENT(svcsock_new_socket,
1962 TP_PROTO(
1963 const struct socket *socket
1964 ),
1965
1966 TP_ARGS(socket),
1967
1968 TP_STRUCT__entry(
1969 __field(unsigned long, type)
1970 __field(unsigned long, family)
1971 __field(bool, listener)
1972 ),
1973
1974 TP_fast_assign(
1975 __entry->type = socket->type;
1976 __entry->family = socket->sk->sk_family;
1977 __entry->listener = (socket->sk->sk_state == TCP_LISTEN);
1978 ),
1979
1980 TP_printk("type=%s family=%s%s",
1981 show_socket_type(__entry->type),
1982 rpc_show_address_family(__entry->family),
1983 __entry->listener ? " (listener)" : ""
1984 )
1985);
1986
Chuck Levera5cda732020-03-16 14:53:04 -04001987TRACE_EVENT(svcsock_marker,
1988 TP_PROTO(
1989 const struct svc_xprt *xprt,
1990 __be32 marker
1991 ),
1992
1993 TP_ARGS(xprt, marker),
1994
1995 TP_STRUCT__entry(
1996 __field(unsigned int, length)
1997 __field(bool, last)
1998 __string(addr, xprt->xpt_remotebuf)
1999 ),
2000
2001 TP_fast_assign(
2002 __entry->length = be32_to_cpu(marker) & RPC_FRAGMENT_SIZE_MASK;
2003 __entry->last = be32_to_cpu(marker) & RPC_LAST_STREAM_FRAGMENT;
2004 __assign_str(addr, xprt->xpt_remotebuf);
2005 ),
2006
2007 TP_printk("addr=%s length=%u%s", __get_str(addr),
2008 __entry->length, __entry->last ? " (last)" : "")
2009);
2010
Chuck Lever998024d2020-03-17 15:06:31 -04002011DECLARE_EVENT_CLASS(svcsock_class,
2012 TP_PROTO(
2013 const struct svc_xprt *xprt,
2014 ssize_t result
2015 ),
2016
2017 TP_ARGS(xprt, result),
2018
2019 TP_STRUCT__entry(
2020 __field(ssize_t, result)
2021 __field(unsigned long, flags)
2022 __string(addr, xprt->xpt_remotebuf)
2023 ),
2024
2025 TP_fast_assign(
2026 __entry->result = result;
2027 __entry->flags = xprt->xpt_flags;
2028 __assign_str(addr, xprt->xpt_remotebuf);
2029 ),
2030
2031 TP_printk("addr=%s result=%zd flags=%s", __get_str(addr),
2032 __entry->result, show_svc_xprt_flags(__entry->flags)
2033 )
2034);
2035
2036#define DEFINE_SVCSOCK_EVENT(name) \
2037 DEFINE_EVENT(svcsock_class, svcsock_##name, \
2038 TP_PROTO( \
2039 const struct svc_xprt *xprt, \
2040 ssize_t result \
2041 ), \
2042 TP_ARGS(xprt, result))
2043
2044DEFINE_SVCSOCK_EVENT(udp_send);
Chuck Leverfff1ebb2020-05-20 17:30:24 -04002045DEFINE_SVCSOCK_EVENT(udp_recv);
2046DEFINE_SVCSOCK_EVENT(udp_recv_err);
Chuck Lever998024d2020-03-17 15:06:31 -04002047DEFINE_SVCSOCK_EVENT(tcp_send);
Chuck Lever7dae1dd2020-05-20 13:41:02 -04002048DEFINE_SVCSOCK_EVENT(tcp_recv);
Chuck Lever6be8c592020-05-20 12:29:13 -04002049DEFINE_SVCSOCK_EVENT(tcp_recv_eagain);
2050DEFINE_SVCSOCK_EVENT(tcp_recv_err);
Chuck Lever998024d2020-03-17 15:06:31 -04002051DEFINE_SVCSOCK_EVENT(data_ready);
2052DEFINE_SVCSOCK_EVENT(write_space);
2053
Chuck Lever6be8c592020-05-20 12:29:13 -04002054TRACE_EVENT(svcsock_tcp_recv_short,
2055 TP_PROTO(
2056 const struct svc_xprt *xprt,
2057 u32 expected,
2058 u32 received
2059 ),
2060
2061 TP_ARGS(xprt, expected, received),
2062
2063 TP_STRUCT__entry(
2064 __field(u32, expected)
2065 __field(u32, received)
2066 __field(unsigned long, flags)
2067 __string(addr, xprt->xpt_remotebuf)
2068 ),
2069
2070 TP_fast_assign(
2071 __entry->expected = expected;
2072 __entry->received = received;
2073 __entry->flags = xprt->xpt_flags;
2074 __assign_str(addr, xprt->xpt_remotebuf);
2075 ),
2076
2077 TP_printk("addr=%s flags=%s expected=%u received=%u",
2078 __get_str(addr), show_svc_xprt_flags(__entry->flags),
2079 __entry->expected, __entry->received
2080 )
2081);
2082
Chuck Levera0469f42020-03-18 11:20:50 -04002083TRACE_EVENT(svcsock_tcp_state,
2084 TP_PROTO(
2085 const struct svc_xprt *xprt,
2086 const struct socket *socket
2087 ),
2088
2089 TP_ARGS(xprt, socket),
2090
2091 TP_STRUCT__entry(
2092 __field(unsigned long, socket_state)
2093 __field(unsigned long, sock_state)
2094 __field(unsigned long, flags)
2095 __string(addr, xprt->xpt_remotebuf)
2096 ),
2097
2098 TP_fast_assign(
2099 __entry->socket_state = socket->state;
2100 __entry->sock_state = socket->sk->sk_state;
2101 __entry->flags = xprt->xpt_flags;
2102 __assign_str(addr, xprt->xpt_remotebuf);
2103 ),
2104
2105 TP_printk("addr=%s state=%s sk_state=%s flags=%s", __get_str(addr),
2106 rpc_show_socket_state(__entry->socket_state),
2107 rpc_show_sock_state(__entry->sock_state),
2108 show_svc_xprt_flags(__entry->flags)
2109 )
2110);
2111
2112DECLARE_EVENT_CLASS(svcsock_accept_class,
2113 TP_PROTO(
2114 const struct svc_xprt *xprt,
2115 const char *service,
2116 long status
2117 ),
2118
2119 TP_ARGS(xprt, service, status),
2120
2121 TP_STRUCT__entry(
2122 __field(long, status)
2123 __string(service, service)
2124 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
2125 ),
2126
2127 TP_fast_assign(
2128 __entry->status = status;
2129 __assign_str(service, service);
2130 memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr));
2131 ),
2132
2133 TP_printk("listener=%pISpc service=%s status=%ld",
2134 __entry->addr, __get_str(service), __entry->status
2135 )
2136);
2137
2138#define DEFINE_ACCEPT_EVENT(name) \
2139 DEFINE_EVENT(svcsock_accept_class, svcsock_##name##_err, \
2140 TP_PROTO( \
2141 const struct svc_xprt *xprt, \
2142 const char *service, \
2143 long status \
2144 ), \
2145 TP_ARGS(xprt, service, status))
2146
2147DEFINE_ACCEPT_EVENT(accept);
2148DEFINE_ACCEPT_EVENT(getpeername);
2149
Trond Myklebust78a947f2020-03-01 18:21:44 -05002150DECLARE_EVENT_CLASS(cache_event,
2151 TP_PROTO(
2152 const struct cache_detail *cd,
2153 const struct cache_head *h
2154 ),
2155
2156 TP_ARGS(cd, h),
2157
2158 TP_STRUCT__entry(
2159 __field(const struct cache_head *, h)
2160 __string(name, cd->name)
2161 ),
2162
2163 TP_fast_assign(
2164 __entry->h = h;
2165 __assign_str(name, cd->name);
2166 ),
2167
2168 TP_printk("cache=%s entry=%p", __get_str(name), __entry->h)
2169);
2170#define DEFINE_CACHE_EVENT(name) \
2171 DEFINE_EVENT(cache_event, name, \
2172 TP_PROTO( \
2173 const struct cache_detail *cd, \
2174 const struct cache_head *h \
2175 ), \
2176 TP_ARGS(cd, h))
2177DEFINE_CACHE_EVENT(cache_entry_expired);
2178DEFINE_CACHE_EVENT(cache_entry_upcall);
2179DEFINE_CACHE_EVENT(cache_entry_update);
2180DEFINE_CACHE_EVENT(cache_entry_make_negative);
2181DEFINE_CACHE_EVENT(cache_entry_no_listener);
2182
Chuck Leverb4af5932020-05-02 11:59:37 -04002183DECLARE_EVENT_CLASS(register_class,
2184 TP_PROTO(
2185 const char *program,
2186 const u32 version,
2187 const int family,
2188 const unsigned short protocol,
2189 const unsigned short port,
2190 int error
2191 ),
2192
2193 TP_ARGS(program, version, family, protocol, port, error),
2194
2195 TP_STRUCT__entry(
2196 __field(u32, version)
2197 __field(unsigned long, family)
2198 __field(unsigned short, protocol)
2199 __field(unsigned short, port)
2200 __field(int, error)
2201 __string(program, program)
2202 ),
2203
2204 TP_fast_assign(
2205 __entry->version = version;
2206 __entry->family = family;
2207 __entry->protocol = protocol;
2208 __entry->port = port;
2209 __entry->error = error;
2210 __assign_str(program, program);
2211 ),
2212
2213 TP_printk("program=%sv%u proto=%s port=%u family=%s error=%d",
2214 __get_str(program), __entry->version,
2215 __entry->protocol == IPPROTO_UDP ? "udp" : "tcp",
2216 __entry->port, rpc_show_address_family(__entry->family),
2217 __entry->error
2218 )
2219);
2220
2221#define DEFINE_REGISTER_EVENT(name) \
2222 DEFINE_EVENT(register_class, svc_##name, \
2223 TP_PROTO( \
2224 const char *program, \
2225 const u32 version, \
2226 const int family, \
2227 const unsigned short protocol, \
2228 const unsigned short port, \
2229 int error \
2230 ), \
2231 TP_ARGS(program, version, family, protocol, \
2232 port, error))
2233
2234DEFINE_REGISTER_EVENT(register);
2235DEFINE_REGISTER_EVENT(noregister);
2236
2237TRACE_EVENT(svc_unregister,
2238 TP_PROTO(
2239 const char *program,
2240 const u32 version,
2241 int error
2242 ),
2243
2244 TP_ARGS(program, version, error),
2245
2246 TP_STRUCT__entry(
2247 __field(u32, version)
2248 __field(int, error)
2249 __string(program, program)
2250 ),
2251
2252 TP_fast_assign(
2253 __entry->version = version;
2254 __entry->error = error;
2255 __assign_str(program, program);
2256 ),
2257
2258 TP_printk("program=%sv%u error=%d",
2259 __get_str(program), __entry->version, __entry->error
2260 )
2261);
2262
Trond Myklebust82b0a4c2012-01-20 14:52:23 -05002263#endif /* _TRACE_SUNRPC_H */
2264
2265#include <trace/define_trace.h>