blob: 29982d60b68ab271729d17190d175559a50eeb85 [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 Leverb4776a32021-10-16 18:02:24 -040017#include <trace/events/sunrpc_base.h>
18
Chuck Lever998024d2020-03-17 15:06:31 -040019TRACE_DEFINE_ENUM(SOCK_STREAM);
20TRACE_DEFINE_ENUM(SOCK_DGRAM);
21TRACE_DEFINE_ENUM(SOCK_RAW);
22TRACE_DEFINE_ENUM(SOCK_RDM);
23TRACE_DEFINE_ENUM(SOCK_SEQPACKET);
24TRACE_DEFINE_ENUM(SOCK_DCCP);
25TRACE_DEFINE_ENUM(SOCK_PACKET);
26
27#define show_socket_type(type) \
28 __print_symbolic(type, \
29 { SOCK_STREAM, "STREAM" }, \
30 { SOCK_DGRAM, "DGRAM" }, \
31 { SOCK_RAW, "RAW" }, \
32 { SOCK_RDM, "RDM" }, \
33 { SOCK_SEQPACKET, "SEQPACKET" }, \
34 { SOCK_DCCP, "DCCP" }, \
35 { SOCK_PACKET, "PACKET" })
36
37/* This list is known to be incomplete, add new enums as needed. */
38TRACE_DEFINE_ENUM(AF_UNSPEC);
39TRACE_DEFINE_ENUM(AF_UNIX);
40TRACE_DEFINE_ENUM(AF_LOCAL);
41TRACE_DEFINE_ENUM(AF_INET);
42TRACE_DEFINE_ENUM(AF_INET6);
43
44#define rpc_show_address_family(family) \
45 __print_symbolic(family, \
46 { AF_UNSPEC, "AF_UNSPEC" }, \
47 { AF_UNIX, "AF_UNIX" }, \
48 { AF_LOCAL, "AF_LOCAL" }, \
49 { AF_INET, "AF_INET" }, \
50 { AF_INET6, "AF_INET6" })
51
Chuck Leverc509f15a2020-05-12 17:13:28 -040052DECLARE_EVENT_CLASS(rpc_xdr_buf_class,
Chuck Leverb20dfc32020-03-02 15:01:08 -050053 TP_PROTO(
Chuck Leverc509f15a2020-05-12 17:13:28 -040054 const struct rpc_task *task,
Chuck Leverb20dfc32020-03-02 15:01:08 -050055 const struct xdr_buf *xdr
56 ),
57
Chuck Leverc509f15a2020-05-12 17:13:28 -040058 TP_ARGS(task, xdr),
Chuck Leverb20dfc32020-03-02 15:01:08 -050059
60 TP_STRUCT__entry(
Chuck Leverc509f15a2020-05-12 17:13:28 -040061 __field(unsigned int, task_id)
62 __field(unsigned int, client_id)
Chuck Leverb20dfc32020-03-02 15:01:08 -050063 __field(const void *, head_base)
64 __field(size_t, head_len)
65 __field(const void *, tail_base)
66 __field(size_t, tail_len)
Chuck Lever35940a52021-10-04 10:16:32 -040067 __field(unsigned int, page_base)
Chuck Leverb20dfc32020-03-02 15:01:08 -050068 __field(unsigned int, page_len)
69 __field(unsigned int, msg_len)
70 ),
71
72 TP_fast_assign(
Chuck Leverc509f15a2020-05-12 17:13:28 -040073 __entry->task_id = task->tk_pid;
Scott Mayhewc3213d22020-11-12 15:17:32 -050074 __entry->client_id = task->tk_client ?
75 task->tk_client->cl_clid : -1;
Chuck Leverb20dfc32020-03-02 15:01:08 -050076 __entry->head_base = xdr->head[0].iov_base;
77 __entry->head_len = xdr->head[0].iov_len;
78 __entry->tail_base = xdr->tail[0].iov_base;
79 __entry->tail_len = xdr->tail[0].iov_len;
Chuck Lever35940a52021-10-04 10:16:32 -040080 __entry->page_base = xdr->page_base;
Chuck Leverb20dfc32020-03-02 15:01:08 -050081 __entry->page_len = xdr->page_len;
82 __entry->msg_len = xdr->len;
83 ),
84
Chuck Leverb4776a32021-10-16 18:02:24 -040085 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
Linus Torvalds38764c72021-11-10 16:45:54 -080086 " head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u",
Chuck Leverc509f15a2020-05-12 17:13:28 -040087 __entry->task_id, __entry->client_id,
Chuck Lever35940a52021-10-04 10:16:32 -040088 __entry->head_base, __entry->head_len,
89 __entry->page_len, __entry->page_base,
90 __entry->tail_base, __entry->tail_len,
91 __entry->msg_len
Chuck Leverb20dfc32020-03-02 15:01:08 -050092 )
93);
94
Chuck Leverc509f15a2020-05-12 17:13:28 -040095#define DEFINE_RPCXDRBUF_EVENT(name) \
96 DEFINE_EVENT(rpc_xdr_buf_class, \
97 rpc_xdr_##name, \
Chuck Leverb20dfc32020-03-02 15:01:08 -050098 TP_PROTO( \
Chuck Leverc509f15a2020-05-12 17:13:28 -040099 const struct rpc_task *task, \
Chuck Leverb20dfc32020-03-02 15:01:08 -0500100 const struct xdr_buf *xdr \
101 ), \
Chuck Leverc509f15a2020-05-12 17:13:28 -0400102 TP_ARGS(task, xdr))
Chuck Leverb20dfc32020-03-02 15:01:08 -0500103
Chuck Leverc509f15a2020-05-12 17:13:28 -0400104DEFINE_RPCXDRBUF_EVENT(sendto);
105DEFINE_RPCXDRBUF_EVENT(recvfrom);
106DEFINE_RPCXDRBUF_EVENT(reply_pages);
107
Chuck Leverb20dfc32020-03-02 15:01:08 -0500108
Chuck Lever42aad0d2020-05-12 17:13:39 -0400109DECLARE_EVENT_CLASS(rpc_clnt_class,
110 TP_PROTO(
111 const struct rpc_clnt *clnt
112 ),
113
114 TP_ARGS(clnt),
115
116 TP_STRUCT__entry(
117 __field(unsigned int, client_id)
118 ),
119
120 TP_fast_assign(
121 __entry->client_id = clnt->cl_clid;
122 ),
123
Chuck Leverb4776a32021-10-16 18:02:24 -0400124 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER, __entry->client_id)
Chuck Lever42aad0d2020-05-12 17:13:39 -0400125);
126
127#define DEFINE_RPC_CLNT_EVENT(name) \
128 DEFINE_EVENT(rpc_clnt_class, \
129 rpc_clnt_##name, \
130 TP_PROTO( \
131 const struct rpc_clnt *clnt \
132 ), \
133 TP_ARGS(clnt))
134
135DEFINE_RPC_CLNT_EVENT(free);
136DEFINE_RPC_CLNT_EVENT(killall);
137DEFINE_RPC_CLNT_EVENT(shutdown);
138DEFINE_RPC_CLNT_EVENT(release);
139DEFINE_RPC_CLNT_EVENT(replace_xprt);
140DEFINE_RPC_CLNT_EVENT(replace_xprt_err);
141
142TRACE_EVENT(rpc_clnt_new,
143 TP_PROTO(
144 const struct rpc_clnt *clnt,
145 const struct rpc_xprt *xprt,
146 const char *program,
147 const char *server
148 ),
149
150 TP_ARGS(clnt, xprt, program, server),
151
152 TP_STRUCT__entry(
153 __field(unsigned int, client_id)
154 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
155 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
156 __string(program, program)
157 __string(server, server)
158 ),
159
160 TP_fast_assign(
161 __entry->client_id = clnt->cl_clid;
162 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
163 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
Joe Perches78c14b32021-06-12 08:42:27 -0700164 __assign_str(program, program);
165 __assign_str(server, server);
Chuck Lever42aad0d2020-05-12 17:13:39 -0400166 ),
167
Chuck Leverb4776a32021-10-16 18:02:24 -0400168 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER
169 " peer=[%s]:%s program=%s server=%s",
Chuck Lever42aad0d2020-05-12 17:13:39 -0400170 __entry->client_id, __get_str(addr), __get_str(port),
171 __get_str(program), __get_str(server))
172);
173
174TRACE_EVENT(rpc_clnt_new_err,
175 TP_PROTO(
176 const char *program,
177 const char *server,
178 int error
179 ),
180
181 TP_ARGS(program, server, error),
182
183 TP_STRUCT__entry(
184 __field(int, error)
185 __string(program, program)
186 __string(server, server)
187 ),
188
189 TP_fast_assign(
190 __entry->error = error;
Joe Perches78c14b32021-06-12 08:42:27 -0700191 __assign_str(program, program);
192 __assign_str(server, server);
Chuck Lever42aad0d2020-05-12 17:13:39 -0400193 ),
194
195 TP_printk("program=%s server=%s error=%d",
196 __get_str(program), __get_str(server), __entry->error)
197);
198
199TRACE_EVENT(rpc_clnt_clone_err,
200 TP_PROTO(
201 const struct rpc_clnt *clnt,
202 int error
203 ),
204
205 TP_ARGS(clnt, error),
206
207 TP_STRUCT__entry(
208 __field(unsigned int, client_id)
209 __field(int, error)
210 ),
211
212 TP_fast_assign(
213 __entry->client_id = clnt->cl_clid;
214 __entry->error = error;
215 ),
216
Chuck Leverb4776a32021-10-16 18:02:24 -0400217 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER " error=%d",
218 __entry->client_id, __entry->error)
Chuck Lever42aad0d2020-05-12 17:13:39 -0400219);
220
Chuck Leverdc5820b2018-12-19 11:00:16 -0500221
222TRACE_DEFINE_ENUM(RPC_AUTH_OK);
223TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED);
224TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED);
225TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF);
226TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF);
227TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK);
228TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM);
229TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM);
230
Steve Dickson5753cba2012-02-06 10:08:08 -0500231#define rpc_show_auth_stat(status) \
Chuck Leverc435da62017-11-03 13:46:14 -0400232 __print_symbolic(status, \
233 { RPC_AUTH_OK, "AUTH_OK" }, \
234 { RPC_AUTH_BADCRED, "BADCRED" }, \
235 { RPC_AUTH_REJECTEDCRED, "REJECTEDCRED" }, \
236 { RPC_AUTH_BADVERF, "BADVERF" }, \
237 { RPC_AUTH_REJECTEDVERF, "REJECTEDVERF" }, \
238 { RPC_AUTH_TOOWEAK, "TOOWEAK" }, \
239 { RPCSEC_GSS_CREDPROBLEM, "GSS_CREDPROBLEM" }, \
240 { RPCSEC_GSS_CTXPROBLEM, "GSS_CTXPROBLEM" }) \
241
242DECLARE_EVENT_CLASS(rpc_task_status,
243
244 TP_PROTO(const struct rpc_task *task),
245
246 TP_ARGS(task),
247
248 TP_STRUCT__entry(
249 __field(unsigned int, task_id)
250 __field(unsigned int, client_id)
251 __field(int, status)
252 ),
253
254 TP_fast_assign(
255 __entry->task_id = task->tk_pid;
256 __entry->client_id = task->tk_client->cl_clid;
257 __entry->status = task->tk_status;
258 ),
259
Chuck Leverb4776a32021-10-16 18:02:24 -0400260 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d",
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500261 __entry->task_id, __entry->client_id,
262 __entry->status)
263);
264#define DEFINE_RPC_STATUS_EVENT(name) \
265 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
266 TP_PROTO( \
267 const struct rpc_task *task \
268 ), \
269 TP_ARGS(task))
270
271DEFINE_RPC_STATUS_EVENT(call);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500272DEFINE_RPC_STATUS_EVENT(connect);
Chuck Lever914cdcc2020-07-08 16:09:58 -0400273DEFINE_RPC_STATUS_EVENT(timeout);
Chuck Lever7c8099f2020-07-08 16:10:03 -0400274DEFINE_RPC_STATUS_EVENT(retry_refresh);
275DEFINE_RPC_STATUS_EVENT(refresh);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500276
Chuck Leverc435da62017-11-03 13:46:14 -0400277TRACE_EVENT(rpc_request,
278 TP_PROTO(const struct rpc_task *task),
279
280 TP_ARGS(task),
281
282 TP_STRUCT__entry(
283 __field(unsigned int, task_id)
284 __field(unsigned int, client_id)
285 __field(int, version)
286 __field(bool, async)
287 __string(progname, task->tk_client->cl_program->name)
288 __string(procname, rpc_proc_name(task))
289 ),
290
291 TP_fast_assign(
292 __entry->task_id = task->tk_pid;
293 __entry->client_id = task->tk_client->cl_clid;
294 __entry->version = task->tk_client->cl_vers;
295 __entry->async = RPC_IS_ASYNC(task);
Joe Perches78c14b32021-06-12 08:42:27 -0700296 __assign_str(progname, task->tk_client->cl_program->name);
297 __assign_str(procname, rpc_proc_name(task));
Chuck Leverc435da62017-11-03 13:46:14 -0400298 ),
299
Chuck Leverb4776a32021-10-16 18:02:24 -0400300 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " %sv%d %s (%ssync)",
Chuck Leverc435da62017-11-03 13:46:14 -0400301 __entry->task_id, __entry->client_id,
302 __get_str(progname), __entry->version,
303 __get_str(procname), __entry->async ? "a": ""
304 )
305);
306
Chuck Lever6f7013832019-02-11 11:24:00 -0500307#define rpc_show_task_flags(flags) \
308 __print_flags(flags, "|", \
309 { RPC_TASK_ASYNC, "ASYNC" }, \
310 { RPC_TASK_SWAPPER, "SWAPPER" }, \
Chuck Leverf9d091c2021-07-19 10:48:22 -0400311 { RPC_TASK_MOVEABLE, "MOVEABLE" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400312 { RPC_TASK_NULLCREDS, "NULLCREDS" }, \
Chuck Lever6f7013832019-02-11 11:24:00 -0500313 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \
314 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \
315 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400316 { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \
Chuck Lever6f7013832019-02-11 11:24:00 -0500317 { RPC_TASK_SOFT, "SOFT" }, \
318 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \
319 { RPC_TASK_SENT, "SENT" }, \
320 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \
321 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \
Chuck Lever7a34c8e2020-05-12 17:13:12 -0400322 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }, \
323 { RPC_TASK_CRED_NOREF, "CRED_NOREF" })
Chuck Lever6f7013832019-02-11 11:24:00 -0500324
Chuck Lever6f7013832019-02-11 11:24:00 -0500325#define rpc_show_runstate(flags) \
326 __print_flags(flags, "|", \
327 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \
328 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \
329 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \
330 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \
331 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \
Trond Myklebustae67bd32019-04-07 13:58:44 -0400332 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }, \
333 { (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" })
Chuck Lever6f7013832019-02-11 11:24:00 -0500334
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500335DECLARE_EVENT_CLASS(rpc_task_running,
336
Chuck Levere671edb2018-03-16 10:33:44 -0400337 TP_PROTO(const struct rpc_task *task, const void *action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500338
Chuck Levere671edb2018-03-16 10:33:44 -0400339 TP_ARGS(task, action),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500340
341 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400342 __field(unsigned int, task_id)
343 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500344 __field(const void *, action)
345 __field(unsigned long, runstate)
346 __field(int, status)
347 __field(unsigned short, flags)
348 ),
349
350 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400351 __entry->client_id = task->tk_client ?
352 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400353 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500354 __entry->action = action;
355 __entry->runstate = task->tk_runstate;
356 __entry->status = task->tk_status;
357 __entry->flags = task->tk_flags;
358 ),
359
Chuck Leverb4776a32021-10-16 18:02:24 -0400360 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
361 " flags=%s runstate=%s status=%d action=%ps",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400362 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500363 rpc_show_task_flags(__entry->flags),
364 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500365 __entry->status,
366 __entry->action
367 )
368);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500369#define DEFINE_RPC_RUNNING_EVENT(name) \
370 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
371 TP_PROTO( \
372 const struct rpc_task *task, \
373 const void *action \
374 ), \
375 TP_ARGS(task, action))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500376
Chuck Leverdc5820b2018-12-19 11:00:16 -0500377DEFINE_RPC_RUNNING_EVENT(begin);
378DEFINE_RPC_RUNNING_EVENT(run_action);
Chuck Lever1466c222020-07-08 16:10:45 -0400379DEFINE_RPC_RUNNING_EVENT(sync_sleep);
380DEFINE_RPC_RUNNING_EVENT(sync_wake);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500381DEFINE_RPC_RUNNING_EVENT(complete);
Chuck Lever721a1d32020-07-08 16:10:50 -0400382DEFINE_RPC_RUNNING_EVENT(timeout);
Chuck Leverabf8af72019-12-23 10:28:28 -0500383DEFINE_RPC_RUNNING_EVENT(signalled);
Chuck Levera264aba2019-11-20 16:25:52 -0500384DEFINE_RPC_RUNNING_EVENT(end);
Chuck Leverb40887e2021-10-16 18:02:57 -0400385DEFINE_RPC_RUNNING_EVENT(call_done);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500386
387DECLARE_EVENT_CLASS(rpc_task_queued,
388
Chuck Levere671edb2018-03-16 10:33:44 -0400389 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500390
Chuck Levere671edb2018-03-16 10:33:44 -0400391 TP_ARGS(task, q),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500392
393 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400394 __field(unsigned int, task_id)
395 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500396 __field(unsigned long, timeout)
397 __field(unsigned long, runstate)
398 __field(int, status)
399 __field(unsigned short, flags)
Trond Myklebust85c0d242012-02-06 10:31:35 -0500400 __string(q_name, rpc_qname(q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500401 ),
402
403 TP_fast_assign(
Chuck Levere671edb2018-03-16 10:33:44 -0400404 __entry->client_id = task->tk_client ?
405 task->tk_client->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400406 __entry->task_id = task->tk_pid;
Trond Myklebust5efd1872019-04-07 13:58:50 -0400407 __entry->timeout = rpc_task_timeout(task);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500408 __entry->runstate = task->tk_runstate;
409 __entry->status = task->tk_status;
410 __entry->flags = task->tk_flags;
Trond Myklebust85c0d242012-02-06 10:31:35 -0500411 __assign_str(q_name, rpc_qname(q));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500412 ),
413
Chuck Leverb4776a32021-10-16 18:02:24 -0400414 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
415 " flags=%s runstate=%s status=%d timeout=%lu queue=%s",
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400416 __entry->task_id, __entry->client_id,
Chuck Lever6f7013832019-02-11 11:24:00 -0500417 rpc_show_task_flags(__entry->flags),
418 rpc_show_runstate(__entry->runstate),
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500419 __entry->status,
420 __entry->timeout,
Trond Myklebust85c0d242012-02-06 10:31:35 -0500421 __get_str(q_name)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500422 )
423);
Chuck Leverdc5820b2018-12-19 11:00:16 -0500424#define DEFINE_RPC_QUEUED_EVENT(name) \
425 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
426 TP_PROTO( \
427 const struct rpc_task *task, \
428 const struct rpc_wait_queue *q \
429 ), \
430 TP_ARGS(task, q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500431
Chuck Leverdc5820b2018-12-19 11:00:16 -0500432DEFINE_RPC_QUEUED_EVENT(sleep);
433DEFINE_RPC_QUEUED_EVENT(wakeup);
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500434
Chuck Levere8680a22019-02-11 11:24:48 -0500435DECLARE_EVENT_CLASS(rpc_failure,
436
437 TP_PROTO(const struct rpc_task *task),
438
439 TP_ARGS(task),
440
441 TP_STRUCT__entry(
442 __field(unsigned int, task_id)
443 __field(unsigned int, client_id)
444 ),
445
446 TP_fast_assign(
447 __entry->task_id = task->tk_pid;
448 __entry->client_id = task->tk_client->cl_clid;
449 ),
450
Chuck Leverb4776a32021-10-16 18:02:24 -0400451 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
Chuck Levere8680a22019-02-11 11:24:48 -0500452 __entry->task_id, __entry->client_id)
453);
454
455#define DEFINE_RPC_FAILURE(name) \
456 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \
457 TP_PROTO( \
458 const struct rpc_task *task \
459 ), \
460 TP_ARGS(task))
461
462DEFINE_RPC_FAILURE(callhdr);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500463DEFINE_RPC_FAILURE(verifier);
464
465DECLARE_EVENT_CLASS(rpc_reply_event,
466
467 TP_PROTO(
468 const struct rpc_task *task
469 ),
470
471 TP_ARGS(task),
472
473 TP_STRUCT__entry(
474 __field(unsigned int, task_id)
475 __field(unsigned int, client_id)
476 __field(u32, xid)
477 __string(progname, task->tk_client->cl_program->name)
478 __field(u32, version)
479 __string(procname, rpc_proc_name(task))
480 __string(servername, task->tk_xprt->servername)
481 ),
482
483 TP_fast_assign(
484 __entry->task_id = task->tk_pid;
485 __entry->client_id = task->tk_client->cl_clid;
486 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
Joe Perches78c14b32021-06-12 08:42:27 -0700487 __assign_str(progname, task->tk_client->cl_program->name);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500488 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700489 __assign_str(procname, rpc_proc_name(task));
490 __assign_str(servername, task->tk_xprt->servername);
Chuck Lever7f5667a2019-02-11 11:24:53 -0500491 ),
492
Chuck Leverb4776a32021-10-16 18:02:24 -0400493 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
494 " server=%s xid=0x%08x %sv%d %s",
Chuck Lever7f5667a2019-02-11 11:24:53 -0500495 __entry->task_id, __entry->client_id, __get_str(servername),
496 __entry->xid, __get_str(progname), __entry->version,
497 __get_str(procname))
498)
499
500#define DEFINE_RPC_REPLY_EVENT(name) \
501 DEFINE_EVENT(rpc_reply_event, rpc__##name, \
502 TP_PROTO( \
503 const struct rpc_task *task \
504 ), \
505 TP_ARGS(task))
506
507DEFINE_RPC_REPLY_EVENT(prog_unavail);
508DEFINE_RPC_REPLY_EVENT(prog_mismatch);
509DEFINE_RPC_REPLY_EVENT(proc_unavail);
510DEFINE_RPC_REPLY_EVENT(garbage_args);
511DEFINE_RPC_REPLY_EVENT(unparsable);
512DEFINE_RPC_REPLY_EVENT(mismatch);
513DEFINE_RPC_REPLY_EVENT(stale_creds);
514DEFINE_RPC_REPLY_EVENT(bad_creds);
515DEFINE_RPC_REPLY_EVENT(auth_tooweak);
Chuck Levere8680a22019-02-11 11:24:48 -0500516
Chuck Lever42ebfc22020-07-08 16:10:14 -0400517#define DEFINE_RPCB_ERROR_EVENT(name) \
518 DEFINE_EVENT(rpc_reply_event, rpcb_##name##_err, \
519 TP_PROTO( \
520 const struct rpc_task *task \
521 ), \
522 TP_ARGS(task))
523
524DEFINE_RPCB_ERROR_EVENT(prog_unavail);
525DEFINE_RPCB_ERROR_EVENT(timeout);
526DEFINE_RPCB_ERROR_EVENT(bind_version);
527DEFINE_RPCB_ERROR_EVENT(unreachable);
528DEFINE_RPCB_ERROR_EVENT(unrecognized);
529
Chuck Lever06e234c2020-07-08 16:09:11 -0400530TRACE_EVENT(rpc_buf_alloc,
531 TP_PROTO(
532 const struct rpc_task *task,
533 int status
534 ),
535
536 TP_ARGS(task, status),
537
538 TP_STRUCT__entry(
539 __field(unsigned int, task_id)
540 __field(unsigned int, client_id)
541 __field(size_t, callsize)
542 __field(size_t, recvsize)
543 __field(int, status)
544 ),
545
546 TP_fast_assign(
547 __entry->task_id = task->tk_pid;
548 __entry->client_id = task->tk_client->cl_clid;
549 __entry->callsize = task->tk_rqstp->rq_callsize;
550 __entry->recvsize = task->tk_rqstp->rq_rcvsize;
551 __entry->status = status;
552 ),
553
Chuck Leverb4776a32021-10-16 18:02:24 -0400554 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
555 " callsize=%zu recvsize=%zu status=%d",
Chuck Lever06e234c2020-07-08 16:09:11 -0400556 __entry->task_id, __entry->client_id,
557 __entry->callsize, __entry->recvsize, __entry->status
558 )
559);
560
Chuck Lever0125ecb2020-05-12 17:13:23 -0400561TRACE_EVENT(rpc_call_rpcerror,
562 TP_PROTO(
563 const struct rpc_task *task,
564 int tk_status,
565 int rpc_status
566 ),
567
568 TP_ARGS(task, tk_status, rpc_status),
569
570 TP_STRUCT__entry(
571 __field(unsigned int, task_id)
572 __field(unsigned int, client_id)
573 __field(int, tk_status)
574 __field(int, rpc_status)
575 ),
576
577 TP_fast_assign(
578 __entry->client_id = task->tk_client->cl_clid;
579 __entry->task_id = task->tk_pid;
580 __entry->tk_status = tk_status;
581 __entry->rpc_status = rpc_status;
582 ),
583
Chuck Leverb4776a32021-10-16 18:02:24 -0400584 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
585 " tk_status=%d rpc_status=%d",
Chuck Lever0125ecb2020-05-12 17:13:23 -0400586 __entry->task_id, __entry->client_id,
587 __entry->tk_status, __entry->rpc_status)
588);
589
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400590TRACE_EVENT(rpc_stats_latency,
591
592 TP_PROTO(
593 const struct rpc_task *task,
594 ktime_t backlog,
595 ktime_t rtt,
596 ktime_t execute
597 ),
598
599 TP_ARGS(task, backlog, rtt, execute),
600
601 TP_STRUCT__entry(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400602 __field(unsigned int, task_id)
603 __field(unsigned int, client_id)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400604 __field(u32, xid)
605 __field(int, version)
606 __string(progname, task->tk_client->cl_program->name)
607 __string(procname, rpc_proc_name(task))
608 __field(unsigned long, backlog)
609 __field(unsigned long, rtt)
610 __field(unsigned long, execute)
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400611 ),
612
613 TP_fast_assign(
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400614 __entry->client_id = task->tk_client->cl_clid;
615 __entry->task_id = task->tk_pid;
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400616 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
617 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700618 __assign_str(progname, task->tk_client->cl_program->name);
619 __assign_str(procname, rpc_proc_name(task));
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400620 __entry->backlog = ktime_to_us(backlog);
621 __entry->rtt = ktime_to_us(rtt);
622 __entry->execute = ktime_to_us(execute);
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400623 ),
624
Chuck Leverb4776a32021-10-16 18:02:24 -0400625 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
626 " xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
Chuck Lever98eb6cf2018-05-01 11:37:19 -0400627 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Lever40bf7eb2018-03-16 10:33:49 -0400628 __get_str(progname), __entry->version, __get_str(procname),
629 __entry->backlog, __entry->rtt, __entry->execute)
630);
631
Chuck Lever55828632019-02-11 11:24:10 -0500632TRACE_EVENT(rpc_xdr_overflow,
633 TP_PROTO(
634 const struct xdr_stream *xdr,
635 size_t requested
636 ),
637
638 TP_ARGS(xdr, requested),
639
640 TP_STRUCT__entry(
641 __field(unsigned int, task_id)
642 __field(unsigned int, client_id)
643 __field(int, version)
644 __field(size_t, requested)
645 __field(const void *, end)
646 __field(const void *, p)
647 __field(const void *, head_base)
648 __field(size_t, head_len)
649 __field(const void *, tail_base)
650 __field(size_t, tail_len)
651 __field(unsigned int, page_len)
652 __field(unsigned int, len)
Chuck Leverd321ff52020-10-23 10:41:07 -0400653 __string(progname, xdr->rqst ?
654 xdr->rqst->rq_task->tk_client->cl_program->name : "unknown")
655 __string(procedure, xdr->rqst ?
656 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown")
Chuck Lever55828632019-02-11 11:24:10 -0500657 ),
658
659 TP_fast_assign(
660 if (xdr->rqst) {
661 const struct rpc_task *task = xdr->rqst->rq_task;
662
663 __entry->task_id = task->tk_pid;
664 __entry->client_id = task->tk_client->cl_clid;
665 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -0700666 task->tk_client->cl_program->name);
Chuck Lever55828632019-02-11 11:24:10 -0500667 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700668 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
Chuck Lever55828632019-02-11 11:24:10 -0500669 } else {
Chuck Leverb4776a32021-10-16 18:02:24 -0400670 __entry->task_id = -1;
671 __entry->client_id = -1;
Joe Perches78c14b32021-06-12 08:42:27 -0700672 __assign_str(progname, "unknown");
Chuck Lever55828632019-02-11 11:24:10 -0500673 __entry->version = 0;
Joe Perches78c14b32021-06-12 08:42:27 -0700674 __assign_str(procedure, "unknown");
Chuck Lever55828632019-02-11 11:24:10 -0500675 }
676 __entry->requested = requested;
677 __entry->end = xdr->end;
678 __entry->p = xdr->p;
679 __entry->head_base = xdr->buf->head[0].iov_base,
680 __entry->head_len = xdr->buf->head[0].iov_len,
681 __entry->page_len = xdr->buf->page_len,
682 __entry->tail_base = xdr->buf->tail[0].iov_base,
683 __entry->tail_len = xdr->buf->tail[0].iov_len,
684 __entry->len = xdr->buf->len;
685 ),
686
Chuck Leverb4776a32021-10-16 18:02:24 -0400687 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
688 " %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
Chuck Lever55828632019-02-11 11:24:10 -0500689 __entry->task_id, __entry->client_id,
690 __get_str(progname), __entry->version, __get_str(procedure),
691 __entry->requested, __entry->p, __entry->end,
692 __entry->head_base, __entry->head_len,
693 __entry->page_len,
694 __entry->tail_base, __entry->tail_len,
695 __entry->len
696 )
697);
698
Chuck Lever7be9cea32019-02-11 11:24:16 -0500699TRACE_EVENT(rpc_xdr_alignment,
700 TP_PROTO(
701 const struct xdr_stream *xdr,
702 size_t offset,
703 unsigned int copied
704 ),
705
706 TP_ARGS(xdr, offset, copied),
707
708 TP_STRUCT__entry(
709 __field(unsigned int, task_id)
710 __field(unsigned int, client_id)
711 __field(int, version)
712 __field(size_t, offset)
713 __field(unsigned int, copied)
714 __field(const void *, head_base)
715 __field(size_t, head_len)
716 __field(const void *, tail_base)
717 __field(size_t, tail_len)
718 __field(unsigned int, page_len)
719 __field(unsigned int, len)
720 __string(progname,
721 xdr->rqst->rq_task->tk_client->cl_program->name)
722 __string(procedure,
723 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
724 ),
725
726 TP_fast_assign(
727 const struct rpc_task *task = xdr->rqst->rq_task;
728
729 __entry->task_id = task->tk_pid;
730 __entry->client_id = task->tk_client->cl_clid;
731 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -0700732 task->tk_client->cl_program->name);
Chuck Lever7be9cea32019-02-11 11:24:16 -0500733 __entry->version = task->tk_client->cl_vers;
Joe Perches78c14b32021-06-12 08:42:27 -0700734 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
Chuck Lever7be9cea32019-02-11 11:24:16 -0500735
736 __entry->offset = offset;
737 __entry->copied = copied;
738 __entry->head_base = xdr->buf->head[0].iov_base,
739 __entry->head_len = xdr->buf->head[0].iov_len,
740 __entry->page_len = xdr->buf->page_len,
741 __entry->tail_base = xdr->buf->tail[0].iov_base,
742 __entry->tail_len = xdr->buf->tail[0].iov_len,
743 __entry->len = xdr->buf->len;
744 ),
745
Chuck Leverb4776a32021-10-16 18:02:24 -0400746 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
747 " %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
Chuck Lever7be9cea32019-02-11 11:24:16 -0500748 __entry->task_id, __entry->client_id,
749 __get_str(progname), __entry->version, __get_str(procedure),
750 __entry->offset, __entry->copied,
751 __entry->head_base, __entry->head_len,
752 __entry->page_len,
753 __entry->tail_base, __entry->tail_len,
754 __entry->len
755 )
756);
757
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400758/*
759 * First define the enums in the below macros to be exported to userspace
760 * via TRACE_DEFINE_ENUM().
761 */
762#undef EM
763#undef EMe
764#define EM(a, b) TRACE_DEFINE_ENUM(a);
765#define EMe(a, b) TRACE_DEFINE_ENUM(a);
766
767#define RPC_SHOW_SOCKET \
768 EM( SS_FREE, "FREE" ) \
769 EM( SS_UNCONNECTED, "UNCONNECTED" ) \
Chuck Lever82909dc2020-05-12 17:13:18 -0400770 EM( SS_CONNECTING, "CONNECTING" ) \
771 EM( SS_CONNECTED, "CONNECTED" ) \
772 EMe( SS_DISCONNECTING, "DISCONNECTING" )
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400773
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400774#define rpc_show_socket_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400775 __print_symbolic(state, RPC_SHOW_SOCKET)
776
777RPC_SHOW_SOCKET
778
779#define RPC_SHOW_SOCK \
780 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
781 EM( TCP_SYN_SENT, "SYN_SENT" ) \
782 EM( TCP_SYN_RECV, "SYN_RECV" ) \
783 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
784 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
785 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
786 EM( TCP_CLOSE, "CLOSE" ) \
787 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
788 EM( TCP_LAST_ACK, "LAST_ACK" ) \
789 EM( TCP_LISTEN, "LISTEN" ) \
790 EMe( TCP_CLOSING, "CLOSING" )
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400791
792#define rpc_show_sock_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400793 __print_symbolic(state, RPC_SHOW_SOCK)
794
795RPC_SHOW_SOCK
796
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000797
798#include <trace/events/net_probe_common.h>
799
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400800/*
801 * Now redefine the EM() and EMe() macros to map the enums to the strings
802 * that will be printed in the output.
803 */
804#undef EM
805#undef EMe
806#define EM(a, b) {a, b},
807#define EMe(a, b) {a, b}
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400808
809DECLARE_EVENT_CLASS(xs_socket_event,
810
811 TP_PROTO(
812 struct rpc_xprt *xprt,
813 struct socket *socket
814 ),
815
816 TP_ARGS(xprt, socket),
817
818 TP_STRUCT__entry(
819 __field(unsigned int, socket_state)
820 __field(unsigned int, sock_state)
821 __field(unsigned long long, ino)
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000822 __array(__u8, saddr, sizeof(struct sockaddr_in6))
823 __array(__u8, daddr, sizeof(struct sockaddr_in6))
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400824 ),
825
826 TP_fast_assign(
827 struct inode *inode = SOCK_INODE(socket);
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000828 const struct sock *sk = socket->sk;
829 const struct inet_sock *inet = inet_sk(sk);
830
831 memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
832 memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
833
834 TP_STORE_ADDR_PORTS(__entry, inet, sk);
835
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400836 __entry->socket_state = socket->state;
837 __entry->sock_state = socket->sk->sk_state;
838 __entry->ino = (unsigned long long)inode->i_ino;
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000839
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400840 ),
841
842 TP_printk(
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000843 "socket:[%llu] srcaddr=%pISpc dstaddr=%pISpc "
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400844 "state=%u (%s) sk_state=%u (%s)",
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000845 __entry->ino,
846 __entry->saddr,
847 __entry->daddr,
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400848 __entry->socket_state,
849 rpc_show_socket_state(__entry->socket_state),
850 __entry->sock_state,
851 rpc_show_sock_state(__entry->sock_state)
852 )
853);
854#define DEFINE_RPC_SOCKET_EVENT(name) \
855 DEFINE_EVENT(xs_socket_event, name, \
856 TP_PROTO( \
857 struct rpc_xprt *xprt, \
858 struct socket *socket \
859 ), \
860 TP_ARGS(xprt, socket))
861
862DECLARE_EVENT_CLASS(xs_socket_event_done,
863
864 TP_PROTO(
865 struct rpc_xprt *xprt,
866 struct socket *socket,
867 int error
868 ),
869
870 TP_ARGS(xprt, socket, error),
871
872 TP_STRUCT__entry(
873 __field(int, error)
874 __field(unsigned int, socket_state)
875 __field(unsigned int, sock_state)
876 __field(unsigned long long, ino)
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000877 __array(__u8, saddr, sizeof(struct sockaddr_in6))
878 __array(__u8, daddr, sizeof(struct sockaddr_in6))
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400879 ),
880
881 TP_fast_assign(
882 struct inode *inode = SOCK_INODE(socket);
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000883 const struct sock *sk = socket->sk;
884 const struct inet_sock *inet = inet_sk(sk);
885
886 memset(__entry->saddr, 0, sizeof(struct sockaddr_in6));
887 memset(__entry->daddr, 0, sizeof(struct sockaddr_in6));
888
889 TP_STORE_ADDR_PORTS(__entry, inet, sk);
890
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400891 __entry->socket_state = socket->state;
892 __entry->sock_state = socket->sk->sk_state;
893 __entry->ino = (unsigned long long)inode->i_ino;
894 __entry->error = error;
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400895 ),
896
897 TP_printk(
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000898 "error=%d socket:[%llu] srcaddr=%pISpc dstaddr=%pISpc "
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400899 "state=%u (%s) sk_state=%u (%s)",
900 __entry->error,
Pierguido Lambri4b0c3592021-12-13 08:38:48 +0000901 __entry->ino,
902 __entry->saddr,
903 __entry->daddr,
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400904 __entry->socket_state,
905 rpc_show_socket_state(__entry->socket_state),
906 __entry->sock_state,
907 rpc_show_sock_state(__entry->sock_state)
908 )
909);
910#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
911 DEFINE_EVENT(xs_socket_event_done, name, \
912 TP_PROTO( \
913 struct rpc_xprt *xprt, \
914 struct socket *socket, \
915 int error \
916 ), \
917 TP_ARGS(xprt, socket, error))
918
919DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
920DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
Trond Myklebuste8353c762013-12-31 13:39:22 -0500921DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400922DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
923DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
924DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
925
Chuck Lever015747d2020-07-08 16:09:32 -0400926TRACE_EVENT(rpc_socket_nospace,
927 TP_PROTO(
928 const struct rpc_rqst *rqst,
929 const struct sock_xprt *transport
930 ),
931
932 TP_ARGS(rqst, transport),
933
934 TP_STRUCT__entry(
935 __field(unsigned int, task_id)
936 __field(unsigned int, client_id)
937 __field(unsigned int, total)
938 __field(unsigned int, remaining)
939 ),
940
941 TP_fast_assign(
942 __entry->task_id = rqst->rq_task->tk_pid;
943 __entry->client_id = rqst->rq_task->tk_client->cl_clid;
944 __entry->total = rqst->rq_slen;
945 __entry->remaining = rqst->rq_slen - transport->xmit.offset;
946 ),
947
Chuck Leverb4776a32021-10-16 18:02:24 -0400948 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
949 " total=%u remaining=%u",
Chuck Lever015747d2020-07-08 16:09:32 -0400950 __entry->task_id, __entry->client_id,
951 __entry->total, __entry->remaining
952 )
953);
954
Chuck Lever94afd9c2020-05-18 10:13:02 -0400955#define rpc_show_xprt_state(x) \
956 __print_flags(x, "|", \
Chuck Lever76497b12021-10-16 18:02:38 -0400957 { BIT(XPRT_LOCKED), "LOCKED" }, \
958 { BIT(XPRT_CONNECTED), "CONNECTED" }, \
959 { BIT(XPRT_CONNECTING), "CONNECTING" }, \
960 { BIT(XPRT_CLOSE_WAIT), "CLOSE_WAIT" }, \
961 { BIT(XPRT_BOUND), "BOUND" }, \
962 { BIT(XPRT_BINDING), "BINDING" }, \
963 { BIT(XPRT_CLOSING), "CLOSING" }, \
964 { BIT(XPRT_OFFLINE), "OFFLINE" }, \
965 { BIT(XPRT_REMOVE), "REMOVE" }, \
966 { BIT(XPRT_CONGESTED), "CONGESTED" }, \
967 { BIT(XPRT_CWND_WAIT), "CWND_WAIT" }, \
Chuck Leveraed28b72022-01-13 12:20:36 -0500968 { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }, \
969 { BIT(XPRT_SND_IS_COOKIE), "SND_IS_COOKIE" })
Chuck Lever94afd9c2020-05-18 10:13:02 -0400970
Chuck Lever911813d2020-05-12 17:13:34 -0400971DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class,
972 TP_PROTO(
973 const struct rpc_xprt *xprt
974 ),
975
976 TP_ARGS(xprt),
977
978 TP_STRUCT__entry(
Chuck Lever94afd9c2020-05-18 10:13:02 -0400979 __field(unsigned long, state)
Chuck Lever911813d2020-05-12 17:13:34 -0400980 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
981 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
982 ),
983
984 TP_fast_assign(
Chuck Lever94afd9c2020-05-18 10:13:02 -0400985 __entry->state = xprt->state;
Chuck Lever911813d2020-05-12 17:13:34 -0400986 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
987 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
988 ),
989
Chuck Lever94afd9c2020-05-18 10:13:02 -0400990 TP_printk("peer=[%s]:%s state=%s",
991 __get_str(addr), __get_str(port),
992 rpc_show_xprt_state(__entry->state))
Chuck Lever911813d2020-05-12 17:13:34 -0400993);
994
995#define DEFINE_RPC_XPRT_LIFETIME_EVENT(name) \
996 DEFINE_EVENT(rpc_xprt_lifetime_class, \
997 xprt_##name, \
998 TP_PROTO( \
999 const struct rpc_xprt *xprt \
1000 ), \
1001 TP_ARGS(xprt))
1002
1003DEFINE_RPC_XPRT_LIFETIME_EVENT(create);
Chuck Leverdb0a86c2020-07-08 16:09:47 -04001004DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);
Chuck Lever911813d2020-05-12 17:13:34 -04001005DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto);
1006DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done);
1007DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force);
1008DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_cleanup);
1009DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy);
1010
Jeff Layton3705ad62014-10-28 14:24:13 -04001011DECLARE_EVENT_CLASS(rpc_xprt_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -05001012 TP_PROTO(
1013 const struct rpc_xprt *xprt,
1014 __be32 xid,
1015 int status
1016 ),
Jeff Layton3705ad62014-10-28 14:24:13 -04001017
1018 TP_ARGS(xprt, xid, status),
1019
1020 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -04001021 __field(u32, xid)
Jeff Layton3705ad62014-10-28 14:24:13 -04001022 __field(int, status)
1023 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
1024 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
1025 ),
1026
1027 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -04001028 __entry->xid = be32_to_cpu(xid);
Jeff Layton3705ad62014-10-28 14:24:13 -04001029 __entry->status = status;
1030 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1031 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1032 ),
1033
Chuck Levera30ccf12017-10-20 10:35:18 -04001034 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
1035 __get_str(port), __entry->xid,
Jeff Layton3705ad62014-10-28 14:24:13 -04001036 __entry->status)
1037);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001038#define DEFINE_RPC_XPRT_EVENT(name) \
1039 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
1040 TP_PROTO( \
1041 const struct rpc_xprt *xprt, \
1042 __be32 xid, \
1043 int status \
1044 ), \
1045 TP_ARGS(xprt, xid, status))
Jeff Layton3705ad62014-10-28 14:24:13 -04001046
Chuck Leverdc5820b2018-12-19 11:00:16 -05001047DEFINE_RPC_XPRT_EVENT(timer);
1048DEFINE_RPC_XPRT_EVENT(lookup_rqst);
Jeff Layton3705ad62014-10-28 14:24:13 -04001049
Chuck Lever0c776682019-02-11 11:25:04 -05001050TRACE_EVENT(xprt_transmit,
1051 TP_PROTO(
1052 const struct rpc_rqst *rqst,
1053 int status
1054 ),
1055
1056 TP_ARGS(rqst, status),
1057
1058 TP_STRUCT__entry(
1059 __field(unsigned int, task_id)
1060 __field(unsigned int, client_id)
1061 __field(u32, xid)
1062 __field(u32, seqno)
1063 __field(int, status)
1064 ),
1065
1066 TP_fast_assign(
1067 __entry->task_id = rqst->rq_task->tk_pid;
Olga Kornievskaiaf87b5432019-03-12 12:06:35 -04001068 __entry->client_id = rqst->rq_task->tk_client ?
1069 rqst->rq_task->tk_client->cl_clid : -1;
Chuck Lever0c776682019-02-11 11:25:04 -05001070 __entry->xid = be32_to_cpu(rqst->rq_xid);
1071 __entry->seqno = rqst->rq_seqno;
1072 __entry->status = status;
1073 ),
1074
Chuck Leverb4776a32021-10-16 18:02:24 -04001075 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1076 " xid=0x%08x seqno=%u status=%d",
Chuck Lever0c776682019-02-11 11:25:04 -05001077 __entry->task_id, __entry->client_id, __entry->xid,
1078 __entry->seqno, __entry->status)
1079);
1080
Chuck Levere936a592021-03-31 13:22:27 -04001081TRACE_EVENT(xprt_retransmit,
1082 TP_PROTO(
1083 const struct rpc_rqst *rqst
1084 ),
1085
1086 TP_ARGS(rqst),
1087
1088 TP_STRUCT__entry(
1089 __field(unsigned int, task_id)
1090 __field(unsigned int, client_id)
1091 __field(u32, xid)
1092 __field(int, ntrans)
1093 __field(int, version)
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001094 __field(unsigned long, timeout)
Chuck Levere936a592021-03-31 13:22:27 -04001095 __string(progname,
1096 rqst->rq_task->tk_client->cl_program->name)
Chuck Leverbe630b92021-07-19 10:48:28 -04001097 __string(procname, rpc_proc_name(rqst->rq_task))
Chuck Levere936a592021-03-31 13:22:27 -04001098 ),
1099
1100 TP_fast_assign(
1101 struct rpc_task *task = rqst->rq_task;
1102
1103 __entry->task_id = task->tk_pid;
1104 __entry->client_id = task->tk_client ?
1105 task->tk_client->cl_clid : -1;
1106 __entry->xid = be32_to_cpu(rqst->rq_xid);
1107 __entry->ntrans = rqst->rq_ntrans;
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001108 __entry->timeout = task->tk_timeout;
Chuck Levere936a592021-03-31 13:22:27 -04001109 __assign_str(progname,
Joe Perches78c14b32021-06-12 08:42:27 -07001110 task->tk_client->cl_program->name);
Chuck Levere936a592021-03-31 13:22:27 -04001111 __entry->version = task->tk_client->cl_vers;
Chuck Leverbe630b92021-07-19 10:48:28 -04001112 __assign_str(procname, rpc_proc_name(task));
Chuck Levere936a592021-03-31 13:22:27 -04001113 ),
1114
Chuck Leverb4776a32021-10-16 18:02:24 -04001115 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1116 " xid=0x%08x %sv%d %s ntrans=%d timeout=%lu",
Chuck Levere936a592021-03-31 13:22:27 -04001117 __entry->task_id, __entry->client_id, __entry->xid,
Chuck Leverbe630b92021-07-19 10:48:28 -04001118 __get_str(progname), __entry->version, __get_str(procname),
Chuck Leverbe17b8c2021-07-19 10:48:34 -04001119 __entry->ntrans, __entry->timeout
Chuck Leverbe630b92021-07-19 10:48:28 -04001120 )
Chuck Levere936a592021-03-31 13:22:27 -04001121);
1122
Chuck Levera25a4cb2018-03-16 10:33:55 -04001123TRACE_EVENT(xprt_ping,
1124 TP_PROTO(const struct rpc_xprt *xprt, int status),
1125
1126 TP_ARGS(xprt, status),
1127
1128 TP_STRUCT__entry(
1129 __field(int, status)
1130 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
1131 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
1132 ),
1133
1134 TP_fast_assign(
1135 __entry->status = status;
1136 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1137 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1138 ),
1139
1140 TP_printk("peer=[%s]:%s status=%d",
1141 __get_str(addr), __get_str(port), __entry->status)
1142);
1143
Chuck Leverbf7ca702019-10-09 12:58:14 -04001144DECLARE_EVENT_CLASS(xprt_writelock_event,
1145 TP_PROTO(
1146 const struct rpc_xprt *xprt, const struct rpc_task *task
1147 ),
1148
1149 TP_ARGS(xprt, task),
1150
1151 TP_STRUCT__entry(
1152 __field(unsigned int, task_id)
1153 __field(unsigned int, client_id)
1154 __field(unsigned int, snd_task_id)
1155 ),
1156
1157 TP_fast_assign(
1158 if (task) {
1159 __entry->task_id = task->tk_pid;
1160 __entry->client_id = task->tk_client ?
1161 task->tk_client->cl_clid : -1;
1162 } else {
1163 __entry->task_id = -1;
1164 __entry->client_id = -1;
1165 }
Chuck Leveraed28b72022-01-13 12:20:36 -05001166 if (xprt->snd_task &&
1167 !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))
1168 __entry->snd_task_id = xprt->snd_task->tk_pid;
1169 else
1170 __entry->snd_task_id = -1;
Chuck Leverbf7ca702019-10-09 12:58:14 -04001171 ),
1172
Chuck Leverb4776a32021-10-16 18:02:24 -04001173 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1174 " snd_task:" SUNRPC_TRACE_PID_SPECIFIER,
Chuck Leverbf7ca702019-10-09 12:58:14 -04001175 __entry->task_id, __entry->client_id,
1176 __entry->snd_task_id)
1177);
1178
1179#define DEFINE_WRITELOCK_EVENT(name) \
1180 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
1181 TP_PROTO( \
1182 const struct rpc_xprt *xprt, \
1183 const struct rpc_task *task \
1184 ), \
1185 TP_ARGS(xprt, task))
1186
1187DEFINE_WRITELOCK_EVENT(reserve_xprt);
1188DEFINE_WRITELOCK_EVENT(release_xprt);
1189
1190DECLARE_EVENT_CLASS(xprt_cong_event,
1191 TP_PROTO(
1192 const struct rpc_xprt *xprt, const struct rpc_task *task
1193 ),
1194
1195 TP_ARGS(xprt, task),
1196
1197 TP_STRUCT__entry(
1198 __field(unsigned int, task_id)
1199 __field(unsigned int, client_id)
1200 __field(unsigned int, snd_task_id)
1201 __field(unsigned long, cong)
1202 __field(unsigned long, cwnd)
1203 __field(bool, wait)
1204 ),
1205
1206 TP_fast_assign(
1207 if (task) {
1208 __entry->task_id = task->tk_pid;
1209 __entry->client_id = task->tk_client ?
1210 task->tk_client->cl_clid : -1;
1211 } else {
1212 __entry->task_id = -1;
1213 __entry->client_id = -1;
1214 }
Chuck Leveraed28b72022-01-13 12:20:36 -05001215 if (xprt->snd_task &&
1216 !test_bit(XPRT_SND_IS_COOKIE, &xprt->state))
1217 __entry->snd_task_id = xprt->snd_task->tk_pid;
1218 else
1219 __entry->snd_task_id = -1;
1220
Chuck Leverbf7ca702019-10-09 12:58:14 -04001221 __entry->cong = xprt->cong;
1222 __entry->cwnd = xprt->cwnd;
1223 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
1224 ),
1225
Chuck Leverb4776a32021-10-16 18:02:24 -04001226 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1227 " snd_task:" SUNRPC_TRACE_PID_SPECIFIER
1228 " cong=%lu cwnd=%lu%s",
Chuck Leverbf7ca702019-10-09 12:58:14 -04001229 __entry->task_id, __entry->client_id,
1230 __entry->snd_task_id, __entry->cong, __entry->cwnd,
1231 __entry->wait ? " (wait)" : "")
1232);
1233
1234#define DEFINE_CONG_EVENT(name) \
1235 DEFINE_EVENT(xprt_cong_event, xprt_##name, \
1236 TP_PROTO( \
1237 const struct rpc_xprt *xprt, \
1238 const struct rpc_task *task \
1239 ), \
1240 TP_ARGS(xprt, task))
1241
1242DEFINE_CONG_EVENT(reserve_cong);
1243DEFINE_CONG_EVENT(release_cong);
1244DEFINE_CONG_EVENT(get_cong);
1245DEFINE_CONG_EVENT(put_cong);
1246
Chuck Lever09d2ba02020-07-08 16:09:21 -04001247TRACE_EVENT(xprt_reserve,
1248 TP_PROTO(
1249 const struct rpc_rqst *rqst
1250 ),
1251
1252 TP_ARGS(rqst),
1253
1254 TP_STRUCT__entry(
1255 __field(unsigned int, task_id)
1256 __field(unsigned int, client_id)
1257 __field(u32, xid)
1258 ),
1259
1260 TP_fast_assign(
1261 __entry->task_id = rqst->rq_task->tk_pid;
1262 __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1263 __entry->xid = be32_to_cpu(rqst->rq_xid);
1264 ),
1265
Chuck Leverb4776a32021-10-16 18:02:24 -04001266 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x",
Chuck Lever09d2ba02020-07-08 16:09:21 -04001267 __entry->task_id, __entry->client_id, __entry->xid
1268 )
1269);
1270
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001271TRACE_EVENT(xs_stream_read_data,
1272 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
Jeff Layton3705ad62014-10-28 14:24:13 -04001273
1274 TP_ARGS(xprt, err, total),
1275
1276 TP_STRUCT__entry(
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001277 __field(ssize_t, err)
1278 __field(size_t, total)
Jeff Layton3705ad62014-10-28 14:24:13 -04001279 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
1280 "(null)")
1281 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
1282 "(null)")
1283 ),
1284
1285 TP_fast_assign(
1286 __entry->err = err;
1287 __entry->total = total;
1288 __assign_str(addr, xprt ?
1289 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
1290 __assign_str(port, xprt ?
1291 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
1292 ),
1293
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001294 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
Jeff Layton3705ad62014-10-28 14:24:13 -04001295 __get_str(port), __entry->err, __entry->total)
1296);
1297
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001298TRACE_EVENT(xs_stream_read_request,
Jeff Layton1a867a02014-10-28 14:24:14 -04001299 TP_PROTO(struct sock_xprt *xs),
1300
1301 TP_ARGS(xs),
1302
1303 TP_STRUCT__entry(
1304 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
1305 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
Chuck Levera30ccf12017-10-20 10:35:18 -04001306 __field(u32, xid)
Jeff Layton1a867a02014-10-28 14:24:14 -04001307 __field(unsigned long, copied)
1308 __field(unsigned int, reclen)
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001309 __field(unsigned int, offset)
Jeff Layton1a867a02014-10-28 14:24:14 -04001310 ),
1311
1312 TP_fast_assign(
1313 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
1314 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
Trond Myklebustd1109aa2018-08-13 15:48:42 -04001315 __entry->xid = be32_to_cpu(xs->recv.xid);
Trond Myklebustd1109aa2018-08-13 15:48:42 -04001316 __entry->copied = xs->recv.copied;
1317 __entry->reclen = xs->recv.len;
1318 __entry->offset = xs->recv.offset;
Jeff Layton1a867a02014-10-28 14:24:14 -04001319 ),
1320
Trond Myklebustc50b8ee2018-09-14 14:26:28 -04001321 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
Chuck Levera30ccf12017-10-20 10:35:18 -04001322 __get_str(addr), __get_str(port), __entry->xid,
Jeff Layton1a867a02014-10-28 14:24:14 -04001323 __entry->copied, __entry->reclen, __entry->offset)
1324);
1325
Chuck Levere465cc32020-07-08 16:10:19 -04001326TRACE_EVENT(rpcb_getport,
1327 TP_PROTO(
1328 const struct rpc_clnt *clnt,
1329 const struct rpc_task *task,
1330 unsigned int bind_version
1331 ),
1332
1333 TP_ARGS(clnt, task, bind_version),
1334
1335 TP_STRUCT__entry(
1336 __field(unsigned int, task_id)
1337 __field(unsigned int, client_id)
1338 __field(unsigned int, program)
1339 __field(unsigned int, version)
1340 __field(int, protocol)
1341 __field(unsigned int, bind_version)
1342 __string(servername, task->tk_xprt->servername)
1343 ),
1344
1345 TP_fast_assign(
1346 __entry->task_id = task->tk_pid;
1347 __entry->client_id = clnt->cl_clid;
1348 __entry->program = clnt->cl_prog;
1349 __entry->version = clnt->cl_vers;
1350 __entry->protocol = task->tk_xprt->prot;
1351 __entry->bind_version = bind_version;
1352 __assign_str(servername, task->tk_xprt->servername);
1353 ),
1354
Chuck Leverb4776a32021-10-16 18:02:24 -04001355 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
1356 " server=%s program=%u version=%u protocol=%d bind_version=%u",
Chuck Levere465cc32020-07-08 16:10:19 -04001357 __entry->task_id, __entry->client_id, __get_str(servername),
1358 __entry->program, __entry->version, __entry->protocol,
1359 __entry->bind_version
1360 )
1361);
Chuck Leverc509f15a2020-05-12 17:13:28 -04001362
Chuck Leverac1ae532020-07-08 16:10:24 -04001363TRACE_EVENT(rpcb_setport,
1364 TP_PROTO(
1365 const struct rpc_task *task,
1366 int status,
1367 unsigned short port
1368 ),
1369
1370 TP_ARGS(task, status, port),
1371
1372 TP_STRUCT__entry(
1373 __field(unsigned int, task_id)
1374 __field(unsigned int, client_id)
1375 __field(int, status)
1376 __field(unsigned short, port)
1377 ),
1378
1379 TP_fast_assign(
1380 __entry->task_id = task->tk_pid;
1381 __entry->client_id = task->tk_client->cl_clid;
1382 __entry->status = status;
1383 __entry->port = port;
1384 ),
1385
Chuck Leverb4776a32021-10-16 18:02:24 -04001386 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d port=%u",
Chuck Leverac1ae532020-07-08 16:10:24 -04001387 __entry->task_id, __entry->client_id,
1388 __entry->status, __entry->port
1389 )
1390);
1391
Chuck Leverc3adcc72020-07-08 16:10:40 -04001392TRACE_EVENT(pmap_register,
1393 TP_PROTO(
1394 u32 program,
1395 u32 version,
1396 int protocol,
1397 unsigned short port
1398 ),
1399
1400 TP_ARGS(program, version, protocol, port),
1401
1402 TP_STRUCT__entry(
1403 __field(unsigned int, program)
1404 __field(unsigned int, version)
1405 __field(int, protocol)
1406 __field(unsigned int, port)
1407 ),
1408
1409 TP_fast_assign(
1410 __entry->program = program;
1411 __entry->version = version;
1412 __entry->protocol = protocol;
1413 __entry->port = port;
1414 ),
1415
1416 TP_printk("program=%u version=%u protocol=%d port=%u",
1417 __entry->program, __entry->version,
1418 __entry->protocol, __entry->port
1419 )
1420);
1421
1422TRACE_EVENT(rpcb_register,
1423 TP_PROTO(
1424 u32 program,
1425 u32 version,
1426 const char *addr,
1427 const char *netid
1428 ),
1429
1430 TP_ARGS(program, version, addr, netid),
1431
1432 TP_STRUCT__entry(
1433 __field(unsigned int, program)
1434 __field(unsigned int, version)
1435 __string(addr, addr)
1436 __string(netid, netid)
1437 ),
1438
1439 TP_fast_assign(
1440 __entry->program = program;
1441 __entry->version = version;
1442 __assign_str(addr, addr);
1443 __assign_str(netid, netid);
1444 ),
1445
1446 TP_printk("program=%u version=%u addr=%s netid=%s",
1447 __entry->program, __entry->version,
1448 __get_str(addr), __get_str(netid)
1449 )
1450);
1451
1452TRACE_EVENT(rpcb_unregister,
1453 TP_PROTO(
1454 u32 program,
1455 u32 version,
1456 const char *netid
1457 ),
1458
1459 TP_ARGS(program, version, netid),
1460
1461 TP_STRUCT__entry(
1462 __field(unsigned int, program)
1463 __field(unsigned int, version)
1464 __string(netid, netid)
1465 ),
1466
1467 TP_fast_assign(
1468 __entry->program = program;
1469 __entry->version = version;
1470 __assign_str(netid, netid);
1471 ),
1472
1473 TP_printk("program=%u version=%u netid=%s",
1474 __entry->program, __entry->version, __get_str(netid)
1475 )
1476);
1477
Chuck Lever5f39d272021-01-03 14:39:27 -05001478/* Record an xdr_buf containing a fully-formed RPC message */
1479DECLARE_EVENT_CLASS(svc_xdr_msg_class,
Chuck Leverc509f15a2020-05-12 17:13:28 -04001480 TP_PROTO(
Chuck Leverc509f15a2020-05-12 17:13:28 -04001481 const struct xdr_buf *xdr
1482 ),
1483
Chuck Lever5f39d272021-01-03 14:39:27 -05001484 TP_ARGS(xdr),
Chuck Leverc509f15a2020-05-12 17:13:28 -04001485
1486 TP_STRUCT__entry(
1487 __field(u32, xid)
1488 __field(const void *, head_base)
1489 __field(size_t, head_len)
1490 __field(const void *, tail_base)
1491 __field(size_t, tail_len)
1492 __field(unsigned int, page_len)
1493 __field(unsigned int, msg_len)
1494 ),
1495
1496 TP_fast_assign(
Chuck Lever5f39d272021-01-03 14:39:27 -05001497 __be32 *p = (__be32 *)xdr->head[0].iov_base;
1498
1499 __entry->xid = be32_to_cpu(*p);
1500 __entry->head_base = p;
1501 __entry->head_len = xdr->head[0].iov_len;
1502 __entry->tail_base = xdr->tail[0].iov_base;
1503 __entry->tail_len = xdr->tail[0].iov_len;
1504 __entry->page_len = xdr->page_len;
1505 __entry->msg_len = xdr->len;
1506 ),
1507
1508 TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
1509 __entry->xid,
1510 __entry->head_base, __entry->head_len, __entry->page_len,
1511 __entry->tail_base, __entry->tail_len, __entry->msg_len
1512 )
1513);
1514
1515#define DEFINE_SVCXDRMSG_EVENT(name) \
1516 DEFINE_EVENT(svc_xdr_msg_class, \
1517 svc_xdr_##name, \
1518 TP_PROTO( \
1519 const struct xdr_buf *xdr \
1520 ), \
1521 TP_ARGS(xdr))
1522
1523DEFINE_SVCXDRMSG_EVENT(recvfrom);
1524
1525/* Record an xdr_buf containing arbitrary data, tagged with an XID */
1526DECLARE_EVENT_CLASS(svc_xdr_buf_class,
1527 TP_PROTO(
1528 __be32 xid,
1529 const struct xdr_buf *xdr
1530 ),
1531
1532 TP_ARGS(xid, xdr),
1533
1534 TP_STRUCT__entry(
1535 __field(u32, xid)
1536 __field(const void *, head_base)
1537 __field(size_t, head_len)
1538 __field(const void *, tail_base)
1539 __field(size_t, tail_len)
Chuck Lever35940a52021-10-04 10:16:32 -04001540 __field(unsigned int, page_base)
Chuck Lever5f39d272021-01-03 14:39:27 -05001541 __field(unsigned int, page_len)
1542 __field(unsigned int, msg_len)
1543 ),
1544
1545 TP_fast_assign(
1546 __entry->xid = be32_to_cpu(xid);
Chuck Leverc509f15a2020-05-12 17:13:28 -04001547 __entry->head_base = xdr->head[0].iov_base;
1548 __entry->head_len = xdr->head[0].iov_len;
1549 __entry->tail_base = xdr->tail[0].iov_base;
1550 __entry->tail_len = xdr->tail[0].iov_len;
Chuck Lever35940a52021-10-04 10:16:32 -04001551 __entry->page_base = xdr->page_base;
Chuck Leverc509f15a2020-05-12 17:13:28 -04001552 __entry->page_len = xdr->page_len;
1553 __entry->msg_len = xdr->len;
1554 ),
1555
Chuck Lever35940a52021-10-04 10:16:32 -04001556 TP_printk("xid=0x%08x head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u",
Chuck Leverc509f15a2020-05-12 17:13:28 -04001557 __entry->xid,
Chuck Lever35940a52021-10-04 10:16:32 -04001558 __entry->head_base, __entry->head_len,
1559 __entry->page_len, __entry->page_base,
1560 __entry->tail_base, __entry->tail_len,
1561 __entry->msg_len
Chuck Leverc509f15a2020-05-12 17:13:28 -04001562 )
1563);
1564
1565#define DEFINE_SVCXDRBUF_EVENT(name) \
1566 DEFINE_EVENT(svc_xdr_buf_class, \
1567 svc_xdr_##name, \
1568 TP_PROTO( \
Chuck Lever5f39d272021-01-03 14:39:27 -05001569 __be32 xid, \
Chuck Leverc509f15a2020-05-12 17:13:28 -04001570 const struct xdr_buf *xdr \
1571 ), \
Chuck Lever5f39d272021-01-03 14:39:27 -05001572 TP_ARGS(xid, xdr))
Chuck Leverc509f15a2020-05-12 17:13:28 -04001573
Chuck Leverc509f15a2020-05-12 17:13:28 -04001574DEFINE_SVCXDRBUF_EVENT(sendto);
1575
Chuck Levera68d5a502020-07-24 15:26:47 -04001576/*
1577 * from include/linux/sunrpc/svc.h
1578 */
1579#define SVC_RQST_FLAG_LIST \
1580 svc_rqst_flag(SECURE) \
1581 svc_rqst_flag(LOCAL) \
1582 svc_rqst_flag(USEDEFERRAL) \
1583 svc_rqst_flag(DROPME) \
1584 svc_rqst_flag(SPLICE_OK) \
1585 svc_rqst_flag(VICTIM) \
1586 svc_rqst_flag(BUSY) \
Chuck Lever9082e1d2021-07-15 15:52:19 -04001587 svc_rqst_flag_end(DATA)
Chuck Levera68d5a502020-07-24 15:26:47 -04001588
1589#undef svc_rqst_flag
1590#undef svc_rqst_flag_end
1591#define svc_rqst_flag(x) TRACE_DEFINE_ENUM(RQ_##x);
1592#define svc_rqst_flag_end(x) TRACE_DEFINE_ENUM(RQ_##x);
1593
1594SVC_RQST_FLAG_LIST
1595
1596#undef svc_rqst_flag
1597#undef svc_rqst_flag_end
1598#define svc_rqst_flag(x) { BIT(RQ_##x), #x },
1599#define svc_rqst_flag_end(x) { BIT(RQ_##x), #x }
1600
Jeff Layton30660e04b2014-11-19 07:51:16 -05001601#define show_rqstp_flags(flags) \
Chuck Levera68d5a502020-07-24 15:26:47 -04001602 __print_flags(flags, "|", SVC_RQST_FLAG_LIST)
Jeff Layton4d152e22014-11-19 07:51:14 -05001603
Chuck Leverd88ff952020-04-15 09:47:41 -04001604TRACE_DEFINE_ENUM(SVC_GARBAGE);
1605TRACE_DEFINE_ENUM(SVC_SYSERR);
1606TRACE_DEFINE_ENUM(SVC_VALID);
1607TRACE_DEFINE_ENUM(SVC_NEGATIVE);
1608TRACE_DEFINE_ENUM(SVC_OK);
1609TRACE_DEFINE_ENUM(SVC_DROP);
1610TRACE_DEFINE_ENUM(SVC_CLOSE);
1611TRACE_DEFINE_ENUM(SVC_DENIED);
1612TRACE_DEFINE_ENUM(SVC_PENDING);
1613TRACE_DEFINE_ENUM(SVC_COMPLETE);
1614
Chuck Leverff27e9f2019-10-24 09:34:10 -04001615#define svc_show_status(status) \
1616 __print_symbolic(status, \
1617 { SVC_GARBAGE, "SVC_GARBAGE" }, \
1618 { SVC_SYSERR, "SVC_SYSERR" }, \
1619 { SVC_VALID, "SVC_VALID" }, \
1620 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \
1621 { SVC_OK, "SVC_OK" }, \
1622 { SVC_DROP, "SVC_DROP" }, \
1623 { SVC_CLOSE, "SVC_CLOSE" }, \
1624 { SVC_DENIED, "SVC_DENIED" }, \
1625 { SVC_PENDING, "SVC_PENDING" }, \
1626 { SVC_COMPLETE, "SVC_COMPLETE" })
1627
1628TRACE_EVENT(svc_authenticate,
Chuck Lever438623a2021-07-15 15:52:06 -04001629 TP_PROTO(const struct svc_rqst *rqst, int auth_res),
Chuck Leverff27e9f2019-10-24 09:34:10 -04001630
Chuck Lever438623a2021-07-15 15:52:06 -04001631 TP_ARGS(rqst, auth_res),
Chuck Leverff27e9f2019-10-24 09:34:10 -04001632
1633 TP_STRUCT__entry(
1634 __field(u32, xid)
1635 __field(unsigned long, svc_status)
1636 __field(unsigned long, auth_stat)
1637 ),
1638
1639 TP_fast_assign(
1640 __entry->xid = be32_to_cpu(rqst->rq_xid);
1641 __entry->svc_status = auth_res;
Chuck Lever438623a2021-07-15 15:52:06 -04001642 __entry->auth_stat = be32_to_cpu(rqst->rq_auth_stat);
Chuck Leverff27e9f2019-10-24 09:34:10 -04001643 ),
1644
1645 TP_printk("xid=0x%08x auth_res=%s auth_stat=%s",
1646 __entry->xid, svc_show_status(__entry->svc_status),
1647 rpc_show_auth_stat(__entry->auth_stat))
1648);
1649
Chuck Lever0b9547b2018-03-27 10:51:22 -04001650TRACE_EVENT(svc_process,
1651 TP_PROTO(const struct svc_rqst *rqst, const char *name),
1652
1653 TP_ARGS(rqst, name),
1654
1655 TP_STRUCT__entry(
1656 __field(u32, xid)
1657 __field(u32, vers)
1658 __field(u32, proc)
1659 __string(service, name)
Chuck Lever5c117202021-08-05 15:11:24 -04001660 __string(procedure, svc_proc_name(rqst))
Vasily Averind4b09ac2018-12-24 14:44:52 +03001661 __string(addr, rqst->rq_xprt ?
1662 rqst->rq_xprt->xpt_remotebuf : "(null)")
Chuck Lever0b9547b2018-03-27 10:51:22 -04001663 ),
1664
1665 TP_fast_assign(
1666 __entry->xid = be32_to_cpu(rqst->rq_xid);
1667 __entry->vers = rqst->rq_vers;
1668 __entry->proc = rqst->rq_proc;
1669 __assign_str(service, name);
Chuck Lever5c117202021-08-05 15:11:24 -04001670 __assign_str(procedure, svc_proc_name(rqst));
Vasily Averind4b09ac2018-12-24 14:44:52 +03001671 __assign_str(addr, rqst->rq_xprt ?
1672 rqst->rq_xprt->xpt_remotebuf : "(null)");
Chuck Lever0b9547b2018-03-27 10:51:22 -04001673 ),
1674
Chuck Lever89ff8742020-12-03 10:22:09 -05001675 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%s",
Chuck Lever0b9547b2018-03-27 10:51:22 -04001676 __get_str(addr), __entry->xid,
Chuck Lever89ff8742020-12-03 10:22:09 -05001677 __get_str(service), __entry->vers,
1678 __get_str(procedure)
1679 )
Chuck Lever0b9547b2018-03-27 10:51:22 -04001680);
1681
Trond Myklebust104f6352016-06-24 10:55:46 -04001682DECLARE_EVENT_CLASS(svc_rqst_event,
1683
Chuck Leverdc5820b2018-12-19 11:00:16 -05001684 TP_PROTO(
1685 const struct svc_rqst *rqst
1686 ),
Trond Myklebust104f6352016-06-24 10:55:46 -04001687
1688 TP_ARGS(rqst),
1689
1690 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -04001691 __field(u32, xid)
Trond Myklebust104f6352016-06-24 10:55:46 -04001692 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001693 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -04001694 ),
1695
1696 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -04001697 __entry->xid = be32_to_cpu(rqst->rq_xid);
Trond Myklebust104f6352016-06-24 10:55:46 -04001698 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001699 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -04001700 ),
1701
Chuck Leverece200d2018-03-27 10:51:00 -04001702 TP_printk("addr=%s xid=0x%08x flags=%s",
1703 __get_str(addr), __entry->xid,
1704 show_rqstp_flags(__entry->flags))
Trond Myklebust104f6352016-06-24 10:55:46 -04001705);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001706#define DEFINE_SVC_RQST_EVENT(name) \
1707 DEFINE_EVENT(svc_rqst_event, svc_##name, \
1708 TP_PROTO( \
1709 const struct svc_rqst *rqst \
1710 ), \
1711 TP_ARGS(rqst))
Trond Myklebust104f6352016-06-24 10:55:46 -04001712
Chuck Leverdc5820b2018-12-19 11:00:16 -05001713DEFINE_SVC_RQST_EVENT(defer);
1714DEFINE_SVC_RQST_EVENT(drop);
Trond Myklebust104f6352016-06-24 10:55:46 -04001715
Jeff Layton860a0d92014-10-28 14:24:12 -04001716DECLARE_EVENT_CLASS(svc_rqst_status,
1717
1718 TP_PROTO(struct svc_rqst *rqst, int status),
1719
1720 TP_ARGS(rqst, status),
1721
1722 TP_STRUCT__entry(
Chuck Levera30ccf12017-10-20 10:35:18 -04001723 __field(u32, xid)
Jeff Layton860a0d92014-10-28 14:24:12 -04001724 __field(int, status)
Jeff Layton4d152e22014-11-19 07:51:14 -05001725 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001726 __string(addr, rqst->rq_xprt->xpt_remotebuf)
Jeff Layton860a0d92014-10-28 14:24:12 -04001727 ),
1728
1729 TP_fast_assign(
Chuck Levera30ccf12017-10-20 10:35:18 -04001730 __entry->xid = be32_to_cpu(rqst->rq_xid);
Jeff Layton860a0d92014-10-28 14:24:12 -04001731 __entry->status = status;
Jeff Layton4d152e22014-11-19 07:51:14 -05001732 __entry->flags = rqst->rq_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001733 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
Jeff Layton860a0d92014-10-28 14:24:12 -04001734 ),
1735
Chuck Leverece200d2018-03-27 10:51:00 -04001736 TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
1737 __get_str(addr), __entry->xid,
1738 __entry->status, show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -04001739);
1740
Jeff Layton860a0d92014-10-28 14:24:12 -04001741DEFINE_EVENT(svc_rqst_status, svc_send,
1742 TP_PROTO(struct svc_rqst *rqst, int status),
1743 TP_ARGS(rqst, status));
1744
Jeff Layton83a712e2014-11-21 14:19:31 -05001745#define show_svc_xprt_flags(flags) \
1746 __print_flags(flags, "|", \
1747 { (1UL << XPT_BUSY), "XPT_BUSY"}, \
1748 { (1UL << XPT_CONN), "XPT_CONN"}, \
1749 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \
1750 { (1UL << XPT_DATA), "XPT_DATA"}, \
1751 { (1UL << XPT_TEMP), "XPT_TEMP"}, \
1752 { (1UL << XPT_DEAD), "XPT_DEAD"}, \
1753 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \
1754 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \
1755 { (1UL << XPT_OLD), "XPT_OLD"}, \
1756 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \
1757 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \
Chuck Lever03edb902018-03-27 10:49:53 -04001758 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \
1759 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \
1760 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"})
Jeff Layton83a712e2014-11-21 14:19:31 -05001761
Chuck Lever4b8f3802020-04-28 17:13:32 -04001762TRACE_EVENT(svc_xprt_create_err,
1763 TP_PROTO(
1764 const char *program,
1765 const char *protocol,
1766 struct sockaddr *sap,
Chuck Leverdc6c6fb2022-01-09 13:26:51 -05001767 size_t salen,
Chuck Lever4b8f3802020-04-28 17:13:32 -04001768 const struct svc_xprt *xprt
1769 ),
1770
Chuck Leverdc6c6fb2022-01-09 13:26:51 -05001771 TP_ARGS(program, protocol, sap, salen, xprt),
Chuck Lever4b8f3802020-04-28 17:13:32 -04001772
1773 TP_STRUCT__entry(
1774 __field(long, error)
1775 __string(program, program)
1776 __string(protocol, protocol)
1777 __array(unsigned char, addr, sizeof(struct sockaddr_in6))
1778 ),
1779
1780 TP_fast_assign(
1781 __entry->error = PTR_ERR(xprt);
1782 __assign_str(program, program);
1783 __assign_str(protocol, protocol);
Chuck Leverdc6c6fb2022-01-09 13:26:51 -05001784 memcpy(__entry->addr, sap, min(salen, sizeof(__entry->addr)));
Chuck Lever4b8f3802020-04-28 17:13:32 -04001785 ),
1786
1787 TP_printk("addr=%pISpc program=%s protocol=%s error=%ld",
1788 __entry->addr, __get_str(program), __get_str(protocol),
1789 __entry->error)
1790);
1791
Chuck Lever5089f3d2021-10-19 15:17:21 -04001792TRACE_EVENT(svc_xprt_enqueue,
Jeff Layton83a712e2014-11-21 14:19:31 -05001793 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
1794
1795 TP_ARGS(xprt, rqst),
1796
1797 TP_STRUCT__entry(
Pratyush Anand051ac382015-08-27 10:01:33 +05301798 __field(int, pid)
1799 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001800 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -05001801 ),
1802
1803 TP_fast_assign(
Pratyush Anand051ac382015-08-27 10:01:33 +05301804 __entry->pid = rqst? rqst->rq_task->pid : 0;
Chuck Leverece200d2018-03-27 10:51:00 -04001805 __entry->flags = xprt->xpt_flags;
1806 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -05001807 ),
1808
Chuck Levere3e67622020-04-28 17:38:13 -04001809 TP_printk("addr=%s pid=%d flags=%s", __get_str(addr),
1810 __entry->pid, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -05001811);
1812
Trond Myklebust82ea2d72016-06-24 10:55:45 -04001813DECLARE_EVENT_CLASS(svc_xprt_event,
Jeff Layton83a712e2014-11-21 14:19:31 -05001814 TP_PROTO(struct svc_xprt *xprt),
1815
1816 TP_ARGS(xprt),
1817
1818 TP_STRUCT__entry(
Jeff Layton83a712e2014-11-21 14:19:31 -05001819 __field(unsigned long, flags)
Chuck Leverece200d2018-03-27 10:51:00 -04001820 __string(addr, xprt->xpt_remotebuf)
Jeff Layton83a712e2014-11-21 14:19:31 -05001821 ),
1822
1823 TP_fast_assign(
Chuck Levercaa3e106d2018-03-27 10:50:07 -04001824 __entry->flags = xprt->xpt_flags;
Chuck Leverece200d2018-03-27 10:51:00 -04001825 __assign_str(addr, xprt->xpt_remotebuf);
Jeff Layton83a712e2014-11-21 14:19:31 -05001826 ),
1827
Chuck Levere3e67622020-04-28 17:38:13 -04001828 TP_printk("addr=%s flags=%s", __get_str(addr),
1829 show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -05001830);
1831
Chuck Lever11bbb0f2020-03-17 17:41:43 -04001832#define DEFINE_SVC_XPRT_EVENT(name) \
1833 DEFINE_EVENT(svc_xprt_event, svc_xprt_##name, \
1834 TP_PROTO( \
1835 struct svc_xprt *xprt \
1836 ), \
1837 TP_ARGS(xprt))
1838
1839DEFINE_SVC_XPRT_EVENT(no_write_space);
1840DEFINE_SVC_XPRT_EVENT(close);
1841DEFINE_SVC_XPRT_EVENT(detach);
1842DEFINE_SVC_XPRT_EVENT(free);
1843
1844TRACE_EVENT(svc_xprt_accept,
1845 TP_PROTO(
1846 const struct svc_xprt *xprt,
1847 const char *service
1848 ),
1849
1850 TP_ARGS(xprt, service),
1851
1852 TP_STRUCT__entry(
1853 __string(addr, xprt->xpt_remotebuf)
1854 __string(protocol, xprt->xpt_class->xcl_name)
1855 __string(service, service)
1856 ),
1857
1858 TP_fast_assign(
1859 __assign_str(addr, xprt->xpt_remotebuf);
Joe Perches78c14b32021-06-12 08:42:27 -07001860 __assign_str(protocol, xprt->xpt_class->xcl_name);
Chuck Lever11bbb0f2020-03-17 17:41:43 -04001861 __assign_str(service, service);
1862 ),
1863
1864 TP_printk("addr=%s protocol=%s service=%s",
1865 __get_str(addr), __get_str(protocol), __get_str(service)
1866 )
1867);
Trond Myklebust82ea2d72016-06-24 10:55:45 -04001868
Chuck Lever55f50882018-03-27 10:52:27 -04001869TRACE_EVENT(svc_xprt_dequeue,
1870 TP_PROTO(struct svc_rqst *rqst),
1871
1872 TP_ARGS(rqst),
1873
1874 TP_STRUCT__entry(
Chuck Lever55f50882018-03-27 10:52:27 -04001875 __field(unsigned long, flags)
1876 __field(unsigned long, wakeup)
1877 __string(addr, rqst->rq_xprt->xpt_remotebuf)
1878 ),
1879
1880 TP_fast_assign(
Chuck Lever55f50882018-03-27 10:52:27 -04001881 __entry->flags = rqst->rq_xprt->xpt_flags;
1882 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
1883 rqst->rq_qtime));
1884 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1885 ),
1886
Chuck Levere3e67622020-04-28 17:38:13 -04001887 TP_printk("addr=%s flags=%s wakeup-us=%lu", __get_str(addr),
1888 show_svc_xprt_flags(__entry->flags), __entry->wakeup)
Chuck Lever55f50882018-03-27 10:52:27 -04001889);
1890
Jeff Layton83a712e2014-11-21 14:19:31 -05001891TRACE_EVENT(svc_wake_up,
1892 TP_PROTO(int pid),
1893
1894 TP_ARGS(pid),
1895
1896 TP_STRUCT__entry(
1897 __field(int, pid)
1898 ),
1899
1900 TP_fast_assign(
1901 __entry->pid = pid;
1902 ),
1903
1904 TP_printk("pid=%d", __entry->pid)
1905);
1906
Chuck Lever22a027e82021-10-04 10:16:26 -04001907TRACE_EVENT(svc_alloc_arg_err,
1908 TP_PROTO(
1909 unsigned int pages
1910 ),
1911
1912 TP_ARGS(pages),
1913
1914 TP_STRUCT__entry(
1915 __field(unsigned int, pages)
1916 ),
1917
1918 TP_fast_assign(
1919 __entry->pages = pages;
1920 ),
1921
1922 TP_printk("pages=%u", __entry->pages)
1923);
1924
Chuck Leveraaba72c2018-03-27 10:51:39 -04001925TRACE_EVENT(svc_stats_latency,
1926 TP_PROTO(const struct svc_rqst *rqst),
1927
1928 TP_ARGS(rqst),
1929
1930 TP_STRUCT__entry(
1931 __field(u32, xid)
1932 __field(unsigned long, execute)
Chuck Lever5c117202021-08-05 15:11:24 -04001933 __string(procedure, svc_proc_name(rqst))
Chuck Leveraaba72c2018-03-27 10:51:39 -04001934 __string(addr, rqst->rq_xprt->xpt_remotebuf)
1935 ),
1936
1937 TP_fast_assign(
1938 __entry->xid = be32_to_cpu(rqst->rq_xid);
1939 __entry->execute = ktime_to_us(ktime_sub(ktime_get(),
1940 rqst->rq_stime));
Chuck Lever5c117202021-08-05 15:11:24 -04001941 __assign_str(procedure, svc_proc_name(rqst));
Chuck Leveraaba72c2018-03-27 10:51:39 -04001942 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1943 ),
1944
Chuck Lever89ff8742020-12-03 10:22:09 -05001945 TP_printk("addr=%s xid=0x%08x proc=%s execute-us=%lu",
1946 __get_str(addr), __entry->xid, __get_str(procedure),
1947 __entry->execute)
Chuck Leveraaba72c2018-03-27 10:51:39 -04001948);
Trond Myklebust104f6352016-06-24 10:55:46 -04001949
1950DECLARE_EVENT_CLASS(svc_deferred_event,
Chuck Leverdc5820b2018-12-19 11:00:16 -05001951 TP_PROTO(
1952 const struct svc_deferred_req *dr
1953 ),
Trond Myklebust104f6352016-06-24 10:55:46 -04001954
1955 TP_ARGS(dr),
1956
1957 TP_STRUCT__entry(
Chuck Lever8954c5c2020-04-15 09:05:26 -04001958 __field(const void *, dr)
Chuck Levera30ccf12017-10-20 10:35:18 -04001959 __field(u32, xid)
Chuck Leverece200d2018-03-27 10:51:00 -04001960 __string(addr, dr->xprt->xpt_remotebuf)
Trond Myklebust104f6352016-06-24 10:55:46 -04001961 ),
1962
1963 TP_fast_assign(
Chuck Lever8954c5c2020-04-15 09:05:26 -04001964 __entry->dr = dr;
Chuck Levera30ccf12017-10-20 10:35:18 -04001965 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
1966 (dr->xprt_hlen>>2)));
Chuck Leverece200d2018-03-27 10:51:00 -04001967 __assign_str(addr, dr->xprt->xpt_remotebuf);
Trond Myklebust104f6352016-06-24 10:55:46 -04001968 ),
1969
Chuck Lever8954c5c2020-04-15 09:05:26 -04001970 TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr,
1971 __entry->xid)
Trond Myklebust104f6352016-06-24 10:55:46 -04001972);
Chuck Lever8954c5c2020-04-15 09:05:26 -04001973
Chuck Leverdc5820b2018-12-19 11:00:16 -05001974#define DEFINE_SVC_DEFERRED_EVENT(name) \
Chuck Lever8954c5c2020-04-15 09:05:26 -04001975 DEFINE_EVENT(svc_deferred_event, svc_defer_##name, \
Chuck Leverdc5820b2018-12-19 11:00:16 -05001976 TP_PROTO( \
1977 const struct svc_deferred_req *dr \
1978 ), \
1979 TP_ARGS(dr))
Trond Myklebust104f6352016-06-24 10:55:46 -04001980
Chuck Leverdc5820b2018-12-19 11:00:16 -05001981DEFINE_SVC_DEFERRED_EVENT(drop);
Chuck Lever8954c5c2020-04-15 09:05:26 -04001982DEFINE_SVC_DEFERRED_EVENT(queue);
1983DEFINE_SVC_DEFERRED_EVENT(recv);
Chuck Leverdc5820b2018-12-19 11:00:16 -05001984
Chuck Lever998024d2020-03-17 15:06:31 -04001985TRACE_EVENT(svcsock_new_socket,
1986 TP_PROTO(
1987 const struct socket *socket
1988 ),
1989
1990 TP_ARGS(socket),
1991
1992 TP_STRUCT__entry(
1993 __field(unsigned long, type)
1994 __field(unsigned long, family)
1995 __field(bool, listener)
1996 ),
1997
1998 TP_fast_assign(
1999 __entry->type = socket->type;
2000 __entry->family = socket->sk->sk_family;
2001 __entry->listener = (socket->sk->sk_state == TCP_LISTEN);
2002 ),
2003
2004 TP_printk("type=%s family=%s%s",
2005 show_socket_type(__entry->type),
2006 rpc_show_address_family(__entry->family),
2007 __entry->listener ? " (listener)" : ""
2008 )
2009);
2010
Chuck Levera5cda732020-03-16 14:53:04 -04002011TRACE_EVENT(svcsock_marker,
2012 TP_PROTO(
2013 const struct svc_xprt *xprt,
2014 __be32 marker
2015 ),
2016
2017 TP_ARGS(xprt, marker),
2018
2019 TP_STRUCT__entry(
2020 __field(unsigned int, length)
2021 __field(bool, last)
2022 __string(addr, xprt->xpt_remotebuf)
2023 ),
2024
2025 TP_fast_assign(
2026 __entry->length = be32_to_cpu(marker) & RPC_FRAGMENT_SIZE_MASK;
2027 __entry->last = be32_to_cpu(marker) & RPC_LAST_STREAM_FRAGMENT;
2028 __assign_str(addr, xprt->xpt_remotebuf);
2029 ),
2030
2031 TP_printk("addr=%s length=%u%s", __get_str(addr),
2032 __entry->length, __entry->last ? " (last)" : "")
2033);
2034
Chuck Lever998024d2020-03-17 15:06:31 -04002035DECLARE_EVENT_CLASS(svcsock_class,
2036 TP_PROTO(
2037 const struct svc_xprt *xprt,
2038 ssize_t result
2039 ),
2040
2041 TP_ARGS(xprt, result),
2042
2043 TP_STRUCT__entry(
2044 __field(ssize_t, result)
2045 __field(unsigned long, flags)
2046 __string(addr, xprt->xpt_remotebuf)
2047 ),
2048
2049 TP_fast_assign(
2050 __entry->result = result;
2051 __entry->flags = xprt->xpt_flags;
2052 __assign_str(addr, xprt->xpt_remotebuf);
2053 ),
2054
2055 TP_printk("addr=%s result=%zd flags=%s", __get_str(addr),
2056 __entry->result, show_svc_xprt_flags(__entry->flags)
2057 )
2058);
2059
2060#define DEFINE_SVCSOCK_EVENT(name) \
2061 DEFINE_EVENT(svcsock_class, svcsock_##name, \
2062 TP_PROTO( \
2063 const struct svc_xprt *xprt, \
2064 ssize_t result \
2065 ), \
2066 TP_ARGS(xprt, result))
2067
2068DEFINE_SVCSOCK_EVENT(udp_send);
Chuck Leverfff1ebb2020-05-20 17:30:24 -04002069DEFINE_SVCSOCK_EVENT(udp_recv);
2070DEFINE_SVCSOCK_EVENT(udp_recv_err);
Chuck Lever998024d2020-03-17 15:06:31 -04002071DEFINE_SVCSOCK_EVENT(tcp_send);
Chuck Lever7dae1dd2020-05-20 13:41:02 -04002072DEFINE_SVCSOCK_EVENT(tcp_recv);
Chuck Lever6be8c592020-05-20 12:29:13 -04002073DEFINE_SVCSOCK_EVENT(tcp_recv_eagain);
2074DEFINE_SVCSOCK_EVENT(tcp_recv_err);
Chuck Lever998024d2020-03-17 15:06:31 -04002075DEFINE_SVCSOCK_EVENT(data_ready);
2076DEFINE_SVCSOCK_EVENT(write_space);
2077
Chuck Lever6be8c592020-05-20 12:29:13 -04002078TRACE_EVENT(svcsock_tcp_recv_short,
2079 TP_PROTO(
2080 const struct svc_xprt *xprt,
2081 u32 expected,
2082 u32 received
2083 ),
2084
2085 TP_ARGS(xprt, expected, received),
2086
2087 TP_STRUCT__entry(
2088 __field(u32, expected)
2089 __field(u32, received)
2090 __field(unsigned long, flags)
2091 __string(addr, xprt->xpt_remotebuf)
2092 ),
2093
2094 TP_fast_assign(
2095 __entry->expected = expected;
2096 __entry->received = received;
2097 __entry->flags = xprt->xpt_flags;
2098 __assign_str(addr, xprt->xpt_remotebuf);
2099 ),
2100
2101 TP_printk("addr=%s flags=%s expected=%u received=%u",
2102 __get_str(addr), show_svc_xprt_flags(__entry->flags),
2103 __entry->expected, __entry->received
2104 )
2105);
2106
Chuck Levera0469f42020-03-18 11:20:50 -04002107TRACE_EVENT(svcsock_tcp_state,
2108 TP_PROTO(
2109 const struct svc_xprt *xprt,
2110 const struct socket *socket
2111 ),
2112
2113 TP_ARGS(xprt, socket),
2114
2115 TP_STRUCT__entry(
2116 __field(unsigned long, socket_state)
2117 __field(unsigned long, sock_state)
2118 __field(unsigned long, flags)
2119 __string(addr, xprt->xpt_remotebuf)
2120 ),
2121
2122 TP_fast_assign(
2123 __entry->socket_state = socket->state;
2124 __entry->sock_state = socket->sk->sk_state;
2125 __entry->flags = xprt->xpt_flags;
2126 __assign_str(addr, xprt->xpt_remotebuf);
2127 ),
2128
2129 TP_printk("addr=%s state=%s sk_state=%s flags=%s", __get_str(addr),
2130 rpc_show_socket_state(__entry->socket_state),
2131 rpc_show_sock_state(__entry->sock_state),
2132 show_svc_xprt_flags(__entry->flags)
2133 )
2134);
2135
2136DECLARE_EVENT_CLASS(svcsock_accept_class,
2137 TP_PROTO(
2138 const struct svc_xprt *xprt,
2139 const char *service,
2140 long status
2141 ),
2142
2143 TP_ARGS(xprt, service, status),
2144
2145 TP_STRUCT__entry(
2146 __field(long, status)
2147 __string(service, service)
Chuck Lever16720862022-01-08 16:59:54 -05002148 __field(unsigned int, netns_ino)
Chuck Levera0469f42020-03-18 11:20:50 -04002149 ),
2150
2151 TP_fast_assign(
2152 __entry->status = status;
2153 __assign_str(service, service);
Chuck Lever16720862022-01-08 16:59:54 -05002154 __entry->netns_ino = xprt->xpt_net->ns.inum;
Chuck Levera0469f42020-03-18 11:20:50 -04002155 ),
2156
Chuck Lever16720862022-01-08 16:59:54 -05002157 TP_printk("addr=listener service=%s status=%ld",
2158 __get_str(service), __entry->status
Chuck Levera0469f42020-03-18 11:20:50 -04002159 )
2160);
2161
2162#define DEFINE_ACCEPT_EVENT(name) \
2163 DEFINE_EVENT(svcsock_accept_class, svcsock_##name##_err, \
2164 TP_PROTO( \
2165 const struct svc_xprt *xprt, \
2166 const char *service, \
2167 long status \
2168 ), \
2169 TP_ARGS(xprt, service, status))
2170
2171DEFINE_ACCEPT_EVENT(accept);
2172DEFINE_ACCEPT_EVENT(getpeername);
2173
Trond Myklebust78a947f2020-03-01 18:21:44 -05002174DECLARE_EVENT_CLASS(cache_event,
2175 TP_PROTO(
2176 const struct cache_detail *cd,
2177 const struct cache_head *h
2178 ),
2179
2180 TP_ARGS(cd, h),
2181
2182 TP_STRUCT__entry(
2183 __field(const struct cache_head *, h)
2184 __string(name, cd->name)
2185 ),
2186
2187 TP_fast_assign(
2188 __entry->h = h;
2189 __assign_str(name, cd->name);
2190 ),
2191
2192 TP_printk("cache=%s entry=%p", __get_str(name), __entry->h)
2193);
2194#define DEFINE_CACHE_EVENT(name) \
2195 DEFINE_EVENT(cache_event, name, \
2196 TP_PROTO( \
2197 const struct cache_detail *cd, \
2198 const struct cache_head *h \
2199 ), \
2200 TP_ARGS(cd, h))
2201DEFINE_CACHE_EVENT(cache_entry_expired);
2202DEFINE_CACHE_EVENT(cache_entry_upcall);
2203DEFINE_CACHE_EVENT(cache_entry_update);
2204DEFINE_CACHE_EVENT(cache_entry_make_negative);
2205DEFINE_CACHE_EVENT(cache_entry_no_listener);
2206
Chuck Leverb4af5932020-05-02 11:59:37 -04002207DECLARE_EVENT_CLASS(register_class,
2208 TP_PROTO(
2209 const char *program,
2210 const u32 version,
2211 const int family,
2212 const unsigned short protocol,
2213 const unsigned short port,
2214 int error
2215 ),
2216
2217 TP_ARGS(program, version, family, protocol, port, error),
2218
2219 TP_STRUCT__entry(
2220 __field(u32, version)
2221 __field(unsigned long, family)
2222 __field(unsigned short, protocol)
2223 __field(unsigned short, port)
2224 __field(int, error)
2225 __string(program, program)
2226 ),
2227
2228 TP_fast_assign(
2229 __entry->version = version;
2230 __entry->family = family;
2231 __entry->protocol = protocol;
2232 __entry->port = port;
2233 __entry->error = error;
2234 __assign_str(program, program);
2235 ),
2236
2237 TP_printk("program=%sv%u proto=%s port=%u family=%s error=%d",
2238 __get_str(program), __entry->version,
2239 __entry->protocol == IPPROTO_UDP ? "udp" : "tcp",
2240 __entry->port, rpc_show_address_family(__entry->family),
2241 __entry->error
2242 )
2243);
2244
2245#define DEFINE_REGISTER_EVENT(name) \
2246 DEFINE_EVENT(register_class, svc_##name, \
2247 TP_PROTO( \
2248 const char *program, \
2249 const u32 version, \
2250 const int family, \
2251 const unsigned short protocol, \
2252 const unsigned short port, \
2253 int error \
2254 ), \
2255 TP_ARGS(program, version, family, protocol, \
2256 port, error))
2257
2258DEFINE_REGISTER_EVENT(register);
2259DEFINE_REGISTER_EVENT(noregister);
2260
2261TRACE_EVENT(svc_unregister,
2262 TP_PROTO(
2263 const char *program,
2264 const u32 version,
2265 int error
2266 ),
2267
2268 TP_ARGS(program, version, error),
2269
2270 TP_STRUCT__entry(
2271 __field(u32, version)
2272 __field(int, error)
2273 __string(program, program)
2274 ),
2275
2276 TP_fast_assign(
2277 __entry->version = version;
2278 __entry->error = error;
2279 __assign_str(program, program);
2280 ),
2281
2282 TP_printk("program=%sv%u error=%d",
2283 __get_str(program), __entry->version, __entry->error
2284 )
2285);
2286
Trond Myklebust82b0a4c2012-01-20 14:52:23 -05002287#endif /* _TRACE_SUNRPC_H */
2288
2289#include <trace/define_trace.h>