Skip to content

Commit 033b87d

Browse files
Dylan Yudakenaxboe
authored andcommitted
io_uring: use the text representation of ops in trace
It is annoying to translate opcodes to textwhen tracing io_uring. Use the io_uring_get_opcode function instead to use the text representation. A downside here might have been that if the opcode is invalid it will not be obvious, however the opcode is already overridden in these cases to 0 (NOP) in io_init_req(). Therefore this is a non issue. Signed-off-by: Dylan Yudaken <[email protected]> Link: https://lore.kernel.org/r/[email protected] [axboe: don't include register, those are not req opcodes] Signed-off-by: Jens Axboe <[email protected]>
1 parent 1460af7 commit 033b87d

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

include/trace/events/io_uring.h

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/tracepoint.h>
99
#include <uapi/linux/io_uring.h>
10+
#include <linux/io_uring.h>
1011

1112
struct io_wq_work;
1213

@@ -169,8 +170,9 @@ TRACE_EVENT(io_uring_queue_async_work,
169170
__entry->rw = rw;
170171
),
171172

172-
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %d, flags 0x%x, %s queue, work %p",
173-
__entry->ctx, __entry->req, __entry->user_data, __entry->opcode,
173+
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %s, flags 0x%x, %s queue, work %p",
174+
__entry->ctx, __entry->req, __entry->user_data,
175+
io_uring_get_opcode(__entry->opcode),
174176
__entry->flags, __entry->rw ? "hashed" : "normal", __entry->work)
175177
);
176178

@@ -205,8 +207,9 @@ TRACE_EVENT(io_uring_defer,
205207
__entry->opcode = opcode;
206208
),
207209

208-
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %d",
209-
__entry->ctx, __entry->req, __entry->data, __entry->opcode)
210+
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %s",
211+
__entry->ctx, __entry->req, __entry->data,
212+
io_uring_get_opcode(__entry->opcode))
210213
);
211214

212215
/**
@@ -305,9 +308,9 @@ TRACE_EVENT(io_uring_fail_link,
305308
__entry->link = link;
306309
),
307310

308-
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %d, link %p",
309-
__entry->ctx, __entry->req, __entry->user_data, __entry->opcode,
310-
__entry->link)
311+
TP_printk("ring %p, request %p, user_data 0x%llx, opcode %s, link %p",
312+
__entry->ctx, __entry->req, __entry->user_data,
313+
io_uring_get_opcode(__entry->opcode), __entry->link)
311314
);
312315

313316
/**
@@ -389,9 +392,9 @@ TRACE_EVENT(io_uring_submit_sqe,
389392
__entry->sq_thread = sq_thread;
390393
),
391394

392-
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %d, flags 0x%x, "
395+
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %s, flags 0x%x, "
393396
"non block %d, sq_thread %d", __entry->ctx, __entry->req,
394-
__entry->user_data, __entry->opcode,
397+
__entry->user_data, io_uring_get_opcode(__entry->opcode),
395398
__entry->flags, __entry->force_nonblock, __entry->sq_thread)
396399
);
397400

@@ -433,8 +436,9 @@ TRACE_EVENT(io_uring_poll_arm,
433436
__entry->events = events;
434437
),
435438

436-
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %d, mask 0x%x, events 0x%x",
437-
__entry->ctx, __entry->req, __entry->user_data, __entry->opcode,
439+
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %s, mask 0x%x, events 0x%x",
440+
__entry->ctx, __entry->req, __entry->user_data,
441+
io_uring_get_opcode(__entry->opcode),
438442
__entry->mask, __entry->events)
439443
);
440444

@@ -470,8 +474,9 @@ TRACE_EVENT(io_uring_task_add,
470474
__entry->mask = mask;
471475
),
472476

473-
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %d, mask %x",
474-
__entry->ctx, __entry->req, __entry->user_data, __entry->opcode,
477+
TP_printk("ring %p, req %p, user_data 0x%llx, opcode %s, mask %x",
478+
__entry->ctx, __entry->req, __entry->user_data,
479+
io_uring_get_opcode(__entry->opcode),
475480
__entry->mask)
476481
);
477482

@@ -530,12 +535,13 @@ TRACE_EVENT(io_uring_req_failed,
530535
),
531536

532537
TP_printk("ring %p, req %p, user_data 0x%llx, "
533-
"opcode %d, flags 0x%x, prio=%d, off=%llu, addr=%llu, "
538+
"opcode %s, flags 0x%x, prio=%d, off=%llu, addr=%llu, "
534539
"len=%u, rw_flags=0x%x, buf_index=%d, "
535540
"personality=%d, file_index=%d, pad=0x%llx, addr3=%llx, "
536541
"error=%d",
537542
__entry->ctx, __entry->req, __entry->user_data,
538-
__entry->opcode, __entry->flags, __entry->ioprio,
543+
io_uring_get_opcode(__entry->opcode),
544+
__entry->flags, __entry->ioprio,
539545
(unsigned long long)__entry->off,
540546
(unsigned long long) __entry->addr, __entry->len,
541547
__entry->op_flags,

0 commit comments

Comments
 (0)