]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/sunrpc-tracepoints-should-display-tk_pid-and-cl_clid.patch
6.6-stable patches
[thirdparty/kernel/stable-queue.git] / queue-5.15 / sunrpc-tracepoints-should-display-tk_pid-and-cl_clid.patch
1 From 3b32616d70fa9bf6ff9a840a7cc93347ec7ae058 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Sat, 16 Oct 2021 18:02:24 -0400
4 Subject: SUNRPC: Tracepoints should display tk_pid and cl_clid as a fixed-size
5 field
6
7 From: Chuck Lever <chuck.lever@oracle.com>
8
9 [ Upstream commit b4776a341ec05e809d21e98db5ed49dbdc81d5d8 ]
10
11 For certain special cases, RPC-related tracepoints record a -1 as
12 the task ID or the client ID. It's ugly for a trace event to display
13 4 billion in these cases.
14
15 To help keep SUNRPC tracepoints consistent, create a macro that
16 defines the print format specifiers for tk_pid and cl_clid. At some
17 point in the future we might try tk_pid with a wider range of values
18 than 0..64K so this makes it easier to make that change.
19
20 RPC tracepoints now look like this:
21
22 <...>-1276 [009] 149.720358: rpc_clnt_new: client=00000005 peer=[192.168.2.55]:20049 program=nfs server=klimt.ib
23
24 <...>-1342 [004] 149.921234: rpc_xdr_recvfrom: task:0000001a@00000005 head=[0xff1242d9ab6dc01c,144] page=0 tail=[(nil),0] len=144
25 <...>-1342 [004] 149.921235: xprt_release_cong: task:0000001a@00000005 snd_task:ffffffff cong=256 cwnd=16384
26 <...>-1342 [004] 149.921235: xprt_put_cong: task:0000001a@00000005 snd_task:ffffffff cong=0 cwnd=16384
27
28 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
29 Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
30 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
31 ---
32 fs/nfs/nfs4trace.h | 9 ++--
33 fs/nfs/nfstrace.h | 6 ++-
34 include/trace/events/rpcgss.h | 18 +++++---
35 include/trace/events/rpcrdma.h | 42 +++++++++--------
36 include/trace/events/sunrpc.h | 74 ++++++++++++++++++------------
37 include/trace/events/sunrpc_base.h | 18 ++++++++
38 6 files changed, 108 insertions(+), 59 deletions(-)
39 create mode 100644 include/trace/events/sunrpc_base.h
40
41 diff --git a/fs/nfs/nfs4trace.h b/fs/nfs/nfs4trace.h
42 index bcd18e96b44fa..39a45bb7d4311 100644
43 --- a/fs/nfs/nfs4trace.h
44 +++ b/fs/nfs/nfs4trace.h
45 @@ -9,6 +9,7 @@
46 #define _TRACE_NFS4_H
47
48 #include <linux/tracepoint.h>
49 +#include <trace/events/sunrpc_base.h>
50
51 TRACE_DEFINE_ENUM(EPERM);
52 TRACE_DEFINE_ENUM(ENOENT);
53 @@ -696,8 +697,8 @@ TRACE_EVENT(nfs4_xdr_bad_operation,
54 __entry->expected = expected;
55 ),
56
57 - TP_printk(
58 - "task:%u@%d xid=0x%08x operation=%u, expected=%u",
59 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
60 + " xid=0x%08x operation=%u, expected=%u",
61 __entry->task_id, __entry->client_id, __entry->xid,
62 __entry->op, __entry->expected
63 )
64 @@ -731,8 +732,8 @@ DECLARE_EVENT_CLASS(nfs4_xdr_event,
65 __entry->error = error;
66 ),
67
68 - TP_printk(
69 - "task:%u@%d xid=0x%08x error=%ld (%s) operation=%u",
70 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
71 + " xid=0x%08x error=%ld (%s) operation=%u",
72 __entry->task_id, __entry->client_id, __entry->xid,
73 -__entry->error, show_nfsv4_errors(__entry->error),
74 __entry->op
75 diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
76 index 589f32fdbe637..69fa637a4aba8 100644
77 --- a/fs/nfs/nfstrace.h
78 +++ b/fs/nfs/nfstrace.h
79 @@ -11,6 +11,8 @@
80 #include <linux/tracepoint.h>
81 #include <linux/iversion.h>
82
83 +#include <trace/events/sunrpc_base.h>
84 +
85 #define nfs_show_file_type(ftype) \
86 __print_symbolic(ftype, \
87 { DT_UNKNOWN, "UNKNOWN" }, \
88 @@ -1359,8 +1361,8 @@ DECLARE_EVENT_CLASS(nfs_xdr_event,
89 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
90 ),
91
92 - TP_printk(
93 - "task:%u@%d xid=0x%08x %sv%d %s error=%ld (%s)",
94 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
95 + " xid=0x%08x %sv%d %s error=%ld (%s)",
96 __entry->task_id, __entry->client_id, __entry->xid,
97 __get_str(program), __entry->version,
98 __get_str(procedure), -__entry->error,
99 diff --git a/include/trace/events/rpcgss.h b/include/trace/events/rpcgss.h
100 index b2a2672e66322..3ba63319af3cd 100644
101 --- a/include/trace/events/rpcgss.h
102 +++ b/include/trace/events/rpcgss.h
103 @@ -13,6 +13,8 @@
104
105 #include <linux/tracepoint.h>
106
107 +#include <trace/events/sunrpc_base.h>
108 +
109 /**
110 ** GSS-API related trace events
111 **/
112 @@ -99,7 +101,7 @@ DECLARE_EVENT_CLASS(rpcgss_gssapi_event,
113 __entry->maj_stat = maj_stat;
114 ),
115
116 - TP_printk("task:%u@%u maj_stat=%s",
117 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " maj_stat=%s",
118 __entry->task_id, __entry->client_id,
119 __entry->maj_stat == 0 ?
120 "GSS_S_COMPLETE" : show_gss_status(__entry->maj_stat))
121 @@ -332,7 +334,8 @@ TRACE_EVENT(rpcgss_unwrap_failed,
122 __entry->client_id = task->tk_client->cl_clid;
123 ),
124
125 - TP_printk("task:%u@%u", __entry->task_id, __entry->client_id)
126 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
127 + __entry->task_id, __entry->client_id)
128 );
129
130 TRACE_EVENT(rpcgss_bad_seqno,
131 @@ -358,7 +361,8 @@ TRACE_EVENT(rpcgss_bad_seqno,
132 __entry->received = received;
133 ),
134
135 - TP_printk("task:%u@%u expected seqno %u, received seqno %u",
136 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
137 + " expected seqno %u, received seqno %u",
138 __entry->task_id, __entry->client_id,
139 __entry->expected, __entry->received)
140 );
141 @@ -386,7 +390,7 @@ TRACE_EVENT(rpcgss_seqno,
142 __entry->seqno = rqst->rq_seqno;
143 ),
144
145 - TP_printk("task:%u@%u xid=0x%08x seqno=%u",
146 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x seqno=%u",
147 __entry->task_id, __entry->client_id,
148 __entry->xid, __entry->seqno)
149 );
150 @@ -418,7 +422,8 @@ TRACE_EVENT(rpcgss_need_reencode,
151 __entry->ret = ret;
152 ),
153
154 - TP_printk("task:%u@%u xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
155 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
156 + " xid=0x%08x rq_seqno=%u seq_xmit=%u reencode %sneeded",
157 __entry->task_id, __entry->client_id,
158 __entry->xid, __entry->seqno, __entry->seq_xmit,
159 __entry->ret ? "" : "un")
160 @@ -452,7 +457,8 @@ TRACE_EVENT(rpcgss_update_slack,
161 __entry->verfsize = auth->au_verfsize;
162 ),
163
164 - TP_printk("task:%u@%u xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
165 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
166 + " xid=0x%08x auth=%p rslack=%u ralign=%u verfsize=%u\n",
167 __entry->task_id, __entry->client_id, __entry->xid,
168 __entry->auth, __entry->rslack, __entry->ralign,
169 __entry->verfsize)
170 diff --git a/include/trace/events/rpcrdma.h b/include/trace/events/rpcrdma.h
171 index de41954995926..28ea73bba4e78 100644
172 --- a/include/trace/events/rpcrdma.h
173 +++ b/include/trace/events/rpcrdma.h
174 @@ -14,7 +14,9 @@
175 #include <linux/sunrpc/rpc_rdma_cid.h>
176 #include <linux/tracepoint.h>
177 #include <rdma/ib_cm.h>
178 +
179 #include <trace/events/rdma.h>
180 +#include <trace/events/sunrpc_base.h>
181
182 /**
183 ** Event classes
184 @@ -279,7 +281,8 @@ DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
185 __entry->nsegs = nsegs;
186 ),
187
188 - TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)",
189 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
190 + " pos=%u %u@0x%016llx:0x%08x (%s)",
191 __entry->task_id, __entry->client_id,
192 __entry->pos, __entry->length,
193 (unsigned long long)__entry->offset, __entry->handle,
194 @@ -326,7 +329,8 @@ DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
195 __entry->nsegs = nsegs;
196 ),
197
198 - TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)",
199 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
200 + " %u@0x%016llx:0x%08x (%s)",
201 __entry->task_id, __entry->client_id,
202 __entry->length, (unsigned long long)__entry->offset,
203 __entry->handle,
204 @@ -387,7 +391,8 @@ DECLARE_EVENT_CLASS(xprtrdma_mr_class,
205 __entry->dir = mr->mr_dir;
206 ),
207
208 - TP_printk("task:%u@%u mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
209 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
210 + " mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
211 __entry->task_id, __entry->client_id,
212 __entry->mr_id, __entry->nents, __entry->length,
213 (unsigned long long)__entry->offset, __entry->handle,
214 @@ -630,9 +635,9 @@ TRACE_EVENT(xprtrdma_nomrs_err,
215 __assign_str(port, rpcrdma_portstr(r_xprt));
216 ),
217
218 - TP_printk("peer=[%s]:%s task:%u@%u",
219 - __get_str(addr), __get_str(port),
220 - __entry->task_id, __entry->client_id
221 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " peer=[%s]:%s",
222 + __entry->task_id, __entry->client_id,
223 + __get_str(addr), __get_str(port)
224 )
225 );
226
227 @@ -693,7 +698,8 @@ TRACE_EVENT(xprtrdma_marshal,
228 __entry->wtype = wtype;
229 ),
230
231 - TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s",
232 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
233 + " xid=0x%08x hdr=%u xdr=%u/%u/%u %s/%s",
234 __entry->task_id, __entry->client_id, __entry->xid,
235 __entry->hdrlen,
236 __entry->headlen, __entry->pagelen, __entry->taillen,
237 @@ -723,7 +729,7 @@ TRACE_EVENT(xprtrdma_marshal_failed,
238 __entry->ret = ret;
239 ),
240
241 - TP_printk("task:%u@%u xid=0x%08x: ret=%d",
242 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
243 __entry->task_id, __entry->client_id, __entry->xid,
244 __entry->ret
245 )
246 @@ -750,7 +756,7 @@ TRACE_EVENT(xprtrdma_prepsend_failed,
247 __entry->ret = ret;
248 ),
249
250 - TP_printk("task:%u@%u xid=0x%08x: ret=%d",
251 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
252 __entry->task_id, __entry->client_id, __entry->xid,
253 __entry->ret
254 )
255 @@ -785,7 +791,7 @@ TRACE_EVENT(xprtrdma_post_send,
256 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
257 ),
258
259 - TP_printk("task:%u@%u cq.id=%u cid=%d (%d SGE%s) %s",
260 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u cid=%d (%d SGE%s) %s",
261 __entry->task_id, __entry->client_id,
262 __entry->cq_id, __entry->completion_id,
263 __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"),
264 @@ -820,7 +826,7 @@ TRACE_EVENT(xprtrdma_post_send_err,
265 __entry->rc = rc;
266 ),
267
268 - TP_printk("task:%u@%u cq.id=%u rc=%d",
269 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u rc=%d",
270 __entry->task_id, __entry->client_id,
271 __entry->cq_id, __entry->rc
272 )
273 @@ -932,7 +938,7 @@ TRACE_EVENT(xprtrdma_post_linv_err,
274 __entry->status = status;
275 ),
276
277 - TP_printk("task:%u@%u status=%d",
278 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d",
279 __entry->task_id, __entry->client_id, __entry->status
280 )
281 );
282 @@ -1120,7 +1126,7 @@ TRACE_EVENT(xprtrdma_reply,
283 __entry->credits = credits;
284 ),
285
286 - TP_printk("task:%u@%u xid=0x%08x credits=%u",
287 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x credits=%u",
288 __entry->task_id, __entry->client_id, __entry->xid,
289 __entry->credits
290 )
291 @@ -1156,7 +1162,7 @@ TRACE_EVENT(xprtrdma_err_vers,
292 __entry->max = be32_to_cpup(max);
293 ),
294
295 - TP_printk("task:%u@%u xid=0x%08x versions=[%u, %u]",
296 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x versions=[%u, %u]",
297 __entry->task_id, __entry->client_id, __entry->xid,
298 __entry->min, __entry->max
299 )
300 @@ -1181,7 +1187,7 @@ TRACE_EVENT(xprtrdma_err_chunk,
301 __entry->xid = be32_to_cpu(rqst->rq_xid);
302 ),
303
304 - TP_printk("task:%u@%u xid=0x%08x",
305 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x",
306 __entry->task_id, __entry->client_id, __entry->xid
307 )
308 );
309 @@ -1207,7 +1213,7 @@ TRACE_EVENT(xprtrdma_err_unrecognized,
310 __entry->procedure = be32_to_cpup(procedure);
311 ),
312
313 - TP_printk("task:%u@%u xid=0x%08x procedure=%u",
314 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x procedure=%u",
315 __entry->task_id, __entry->client_id, __entry->xid,
316 __entry->procedure
317 )
318 @@ -1239,7 +1245,7 @@ TRACE_EVENT(xprtrdma_fixup,
319 __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len;
320 ),
321
322 - TP_printk("task:%u@%u fixup=%lu xdr=%zu/%u/%zu",
323 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " fixup=%lu xdr=%zu/%u/%zu",
324 __entry->task_id, __entry->client_id, __entry->fixup,
325 __entry->headlen, __entry->pagelen, __entry->taillen
326 )
327 @@ -1289,7 +1295,7 @@ TRACE_EVENT(xprtrdma_mrs_zap,
328 __entry->client_id = task->tk_client->cl_clid;
329 ),
330
331 - TP_printk("task:%u@%u",
332 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
333 __entry->task_id, __entry->client_id
334 )
335 );
336 diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
337 index f09bbb6c918e2..68ae89c9a1c20 100644
338 --- a/include/trace/events/sunrpc.h
339 +++ b/include/trace/events/sunrpc.h
340 @@ -14,6 +14,8 @@
341 #include <linux/net.h>
342 #include <linux/tracepoint.h>
343
344 +#include <trace/events/sunrpc_base.h>
345 +
346 TRACE_DEFINE_ENUM(SOCK_STREAM);
347 TRACE_DEFINE_ENUM(SOCK_DGRAM);
348 TRACE_DEFINE_ENUM(SOCK_RAW);
349 @@ -78,7 +80,8 @@ DECLARE_EVENT_CLASS(rpc_xdr_buf_class,
350 __entry->msg_len = xdr->len;
351 ),
352
353 - TP_printk("task:%u@%u head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
354 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
355 + " head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
356 __entry->task_id, __entry->client_id,
357 __entry->head_base, __entry->head_len, __entry->page_len,
358 __entry->tail_base, __entry->tail_len, __entry->msg_len
359 @@ -114,7 +117,7 @@ DECLARE_EVENT_CLASS(rpc_clnt_class,
360 __entry->client_id = clnt->cl_clid;
361 ),
362
363 - TP_printk("clid=%u", __entry->client_id)
364 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER, __entry->client_id)
365 );
366
367 #define DEFINE_RPC_CLNT_EVENT(name) \
368 @@ -158,7 +161,8 @@ TRACE_EVENT(rpc_clnt_new,
369 __assign_str(server, server);
370 ),
371
372 - TP_printk("client=%u peer=[%s]:%s program=%s server=%s",
373 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER
374 + " peer=[%s]:%s program=%s server=%s",
375 __entry->client_id, __get_str(addr), __get_str(port),
376 __get_str(program), __get_str(server))
377 );
378 @@ -206,7 +210,8 @@ TRACE_EVENT(rpc_clnt_clone_err,
379 __entry->error = error;
380 ),
381
382 - TP_printk("client=%u error=%d", __entry->client_id, __entry->error)
383 + TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER " error=%d",
384 + __entry->client_id, __entry->error)
385 );
386
387
388 @@ -248,7 +253,7 @@ DECLARE_EVENT_CLASS(rpc_task_status,
389 __entry->status = task->tk_status;
390 ),
391
392 - TP_printk("task:%u@%u status=%d",
393 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d",
394 __entry->task_id, __entry->client_id,
395 __entry->status)
396 );
397 @@ -288,7 +293,7 @@ TRACE_EVENT(rpc_request,
398 __assign_str(procname, rpc_proc_name(task));
399 ),
400
401 - TP_printk("task:%u@%u %sv%d %s (%ssync)",
402 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " %sv%d %s (%ssync)",
403 __entry->task_id, __entry->client_id,
404 __get_str(progname), __entry->version,
405 __get_str(procname), __entry->async ? "a": ""
406 @@ -348,7 +353,8 @@ DECLARE_EVENT_CLASS(rpc_task_running,
407 __entry->flags = task->tk_flags;
408 ),
409
410 - TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps",
411 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
412 + " flags=%s runstate=%s status=%d action=%ps",
413 __entry->task_id, __entry->client_id,
414 rpc_show_task_flags(__entry->flags),
415 rpc_show_runstate(__entry->runstate),
416 @@ -400,7 +406,8 @@ DECLARE_EVENT_CLASS(rpc_task_queued,
417 __assign_str(q_name, rpc_qname(q));
418 ),
419
420 - TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
421 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
422 + " flags=%s runstate=%s status=%d timeout=%lu queue=%s",
423 __entry->task_id, __entry->client_id,
424 rpc_show_task_flags(__entry->flags),
425 rpc_show_runstate(__entry->runstate),
426 @@ -436,7 +443,7 @@ DECLARE_EVENT_CLASS(rpc_failure,
427 __entry->client_id = task->tk_client->cl_clid;
428 ),
429
430 - TP_printk("task:%u@%u",
431 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
432 __entry->task_id, __entry->client_id)
433 );
434
435 @@ -478,7 +485,8 @@ DECLARE_EVENT_CLASS(rpc_reply_event,
436 __assign_str(servername, task->tk_xprt->servername);
437 ),
438
439 - TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s",
440 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
441 + " server=%s xid=0x%08x %sv%d %s",
442 __entry->task_id, __entry->client_id, __get_str(servername),
443 __entry->xid, __get_str(progname), __entry->version,
444 __get_str(procname))
445 @@ -538,7 +546,8 @@ TRACE_EVENT(rpc_buf_alloc,
446 __entry->status = status;
447 ),
448
449 - TP_printk("task:%u@%u callsize=%zu recvsize=%zu status=%d",
450 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
451 + " callsize=%zu recvsize=%zu status=%d",
452 __entry->task_id, __entry->client_id,
453 __entry->callsize, __entry->recvsize, __entry->status
454 )
455 @@ -567,7 +576,8 @@ TRACE_EVENT(rpc_call_rpcerror,
456 __entry->rpc_status = rpc_status;
457 ),
458
459 - TP_printk("task:%u@%u tk_status=%d rpc_status=%d",
460 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
461 + " tk_status=%d rpc_status=%d",
462 __entry->task_id, __entry->client_id,
463 __entry->tk_status, __entry->rpc_status)
464 );
465 @@ -607,7 +617,8 @@ TRACE_EVENT(rpc_stats_latency,
466 __entry->execute = ktime_to_us(execute);
467 ),
468
469 - TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
470 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
471 + " xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
472 __entry->task_id, __entry->client_id, __entry->xid,
473 __get_str(progname), __entry->version, __get_str(procname),
474 __entry->backlog, __entry->rtt, __entry->execute)
475 @@ -651,8 +662,8 @@ TRACE_EVENT(rpc_xdr_overflow,
476 __entry->version = task->tk_client->cl_vers;
477 __assign_str(procedure, task->tk_msg.rpc_proc->p_name);
478 } else {
479 - __entry->task_id = 0;
480 - __entry->client_id = 0;
481 + __entry->task_id = -1;
482 + __entry->client_id = -1;
483 __assign_str(progname, "unknown");
484 __entry->version = 0;
485 __assign_str(procedure, "unknown");
486 @@ -668,8 +679,8 @@ TRACE_EVENT(rpc_xdr_overflow,
487 __entry->len = xdr->buf->len;
488 ),
489
490 - TP_printk(
491 - "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
492 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
493 + " %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
494 __entry->task_id, __entry->client_id,
495 __get_str(progname), __entry->version, __get_str(procedure),
496 __entry->requested, __entry->p, __entry->end,
497 @@ -727,8 +738,8 @@ TRACE_EVENT(rpc_xdr_alignment,
498 __entry->len = xdr->buf->len;
499 ),
500
501 - TP_printk(
502 - "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
503 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
504 + " %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
505 __entry->task_id, __entry->client_id,
506 __get_str(progname), __entry->version, __get_str(procedure),
507 __entry->offset, __entry->copied,
508 @@ -917,7 +928,8 @@ TRACE_EVENT(rpc_socket_nospace,
509 __entry->remaining = rqst->rq_slen - transport->xmit.offset;
510 ),
511
512 - TP_printk("task:%u@%u total=%u remaining=%u",
513 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
514 + " total=%u remaining=%u",
515 __entry->task_id, __entry->client_id,
516 __entry->total, __entry->remaining
517 )
518 @@ -1042,8 +1054,8 @@ TRACE_EVENT(xprt_transmit,
519 __entry->status = status;
520 ),
521
522 - TP_printk(
523 - "task:%u@%u xid=0x%08x seqno=%u status=%d",
524 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
525 + " xid=0x%08x seqno=%u status=%d",
526 __entry->task_id, __entry->client_id, __entry->xid,
527 __entry->seqno, __entry->status)
528 );
529 @@ -1082,8 +1094,8 @@ TRACE_EVENT(xprt_retransmit,
530 __assign_str(procname, rpc_proc_name(task));
531 ),
532
533 - TP_printk(
534 - "task:%u@%u xid=0x%08x %sv%d %s ntrans=%d timeout=%lu",
535 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
536 + " xid=0x%08x %sv%d %s ntrans=%d timeout=%lu",
537 __entry->task_id, __entry->client_id, __entry->xid,
538 __get_str(progname), __entry->version, __get_str(procname),
539 __entry->ntrans, __entry->timeout
540 @@ -1140,7 +1152,8 @@ DECLARE_EVENT_CLASS(xprt_writelock_event,
541 __entry->snd_task_id = -1;
542 ),
543
544 - TP_printk("task:%u@%u snd_task:%u",
545 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
546 + " snd_task:" SUNRPC_TRACE_PID_SPECIFIER,
547 __entry->task_id, __entry->client_id,
548 __entry->snd_task_id)
549 );
550 @@ -1192,7 +1205,9 @@ DECLARE_EVENT_CLASS(xprt_cong_event,
551 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
552 ),
553
554 - TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s",
555 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
556 + " snd_task:" SUNRPC_TRACE_PID_SPECIFIER
557 + " cong=%lu cwnd=%lu%s",
558 __entry->task_id, __entry->client_id,
559 __entry->snd_task_id, __entry->cong, __entry->cwnd,
560 __entry->wait ? " (wait)" : "")
561 @@ -1230,7 +1245,7 @@ TRACE_EVENT(xprt_reserve,
562 __entry->xid = be32_to_cpu(rqst->rq_xid);
563 ),
564
565 - TP_printk("task:%u@%u xid=0x%08x",
566 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x",
567 __entry->task_id, __entry->client_id, __entry->xid
568 )
569 );
570 @@ -1319,7 +1334,8 @@ TRACE_EVENT(rpcb_getport,
571 __assign_str(servername, task->tk_xprt->servername);
572 ),
573
574 - TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u",
575 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
576 + " server=%s program=%u version=%u protocol=%d bind_version=%u",
577 __entry->task_id, __entry->client_id, __get_str(servername),
578 __entry->program, __entry->version, __entry->protocol,
579 __entry->bind_version
580 @@ -1349,7 +1365,7 @@ TRACE_EVENT(rpcb_setport,
581 __entry->port = port;
582 ),
583
584 - TP_printk("task:%u@%u status=%d port=%u",
585 + TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d port=%u",
586 __entry->task_id, __entry->client_id,
587 __entry->status, __entry->port
588 )
589 diff --git a/include/trace/events/sunrpc_base.h b/include/trace/events/sunrpc_base.h
590 new file mode 100644
591 index 0000000000000..588557d07ea82
592 --- /dev/null
593 +++ b/include/trace/events/sunrpc_base.h
594 @@ -0,0 +1,18 @@
595 +/* SPDX-License-Identifier: GPL-2.0 */
596 +/*
597 + * Copyright (c) 2021 Oracle and/or its affiliates.
598 + *
599 + * Common types and format specifiers for sunrpc.
600 + */
601 +
602 +#if !defined(_TRACE_SUNRPC_BASE_H)
603 +#define _TRACE_SUNRPC_BASE_H
604 +
605 +#include <linux/tracepoint.h>
606 +
607 +#define SUNRPC_TRACE_PID_SPECIFIER "%08x"
608 +#define SUNRPC_TRACE_CLID_SPECIFIER "%08x"
609 +#define SUNRPC_TRACE_TASK_SPECIFIER \
610 + "task:" SUNRPC_TRACE_PID_SPECIFIER "@" SUNRPC_TRACE_CLID_SPECIFIER
611 +
612 +#endif /* _TRACE_SUNRPC_BASE_H */
613 --
614 2.43.0
615