History

io_uring: add tracing for additional CQE32 fields

This adds tracing for the extra1 and extra2 fields.

Stefan Roesch committed 4 years ago

Commit c4bb9641 parent e45a3e02 files · +20 −9Browse files

Unified · Split

2 files
  1. fs/io_uring.c +6 −5
  2. include/trace/events/io_uring.h +14 −4
fs/io_uring.c+6−5
@@ -2348,7 +2348,7 @@ static inline bool __io_fill_cqe_req_filled(struct io_ring_ctx *ctx, · 2347 unmodified lines
23482348 struct io_uring_cqe *cqe;
23492349
23502350 trace_io_uring_complete(req->ctx, req, req->cqe.user_data,
2351− req->cqe.res, req->cqe.flags);
2351+ req->cqe.res, req->cqe.flags, 0, 0);
23522352
23532353 /*
23542354 * If we can't get a cq entry, userspace overflowed the
@@ -2372,7 +2372,7 @@ static inline bool __io_fill_cqe32_req_filled(struct io_ring_ctx *ctx, · 17 unmodified lines
23722372 u64 extra2 = req->extra2;
23732373
23742374 trace_io_uring_complete(req->ctx, req, req->cqe.user_data,
2375− req->cqe.res, req->cqe.flags);
2375+ req->cqe.res, req->cqe.flags, extra1, extra2);
23762376
23772377 /*
23782378 * If we can't get a cq entry, userspace overflowed the
@@ -2393,7 +2393,7 @@ static inline bool __io_fill_cqe32_req_filled(struct io_ring_ctx *ctx, · 14 unmodified lines
23932393
23942394 static inline bool __io_fill_cqe_req(struct io_kiocb *req, s32 res, u32 cflags)
23952395 {
2396− trace_io_uring_complete(req->ctx, req, req->cqe.user_data, res, cflags);
2396+ trace_io_uring_complete(req->ctx, req, req->cqe.user_data, res, cflags, 0, 0);
23972397 return __io_fill_cqe(req->ctx, req->cqe.user_data, res, cflags);
23982398 }
23992399
@@ -2408,7 +2408,8 @@ static inline void __io_fill_cqe32_req(struct io_kiocb *req, s32 res, u32 cflags · 8 unmodified lines
24082408 if (req->flags & REQ_F_CQE_SKIP)
24092409 return;
24102410
2411− trace_io_uring_complete(ctx, req, req->cqe.user_data, res, cflags);
2411+ trace_io_uring_complete(ctx, req, req->cqe.user_data, res, cflags,
2412+ extra1, extra2);
24122413
24132414 /*
24142415 * If we can't get a cq entry, userspace overflowed the
@@ -2432,7 +2433,7 @@ static noinline bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, · 17 unmodified lines
24322433 s32 res, u32 cflags)
24332434 {
24342435 ctx->cq_extra++;
2435− trace_io_uring_complete(ctx, NULL, user_data, res, cflags);
2436+ trace_io_uring_complete(ctx, NULL, user_data, res, cflags, 0, 0);
24362437 return __io_fill_cqe(ctx, user_data, res, cflags);
24372438 }
24382439
include/trace/events/io_uring.h+14−4
@@ -321,13 +321,16 @@ TRACE_EVENT(io_uring_fail_link, · 320 unmodified lines
321321 * @user_data: user data associated with the request
322322 * @res: result of the request
323323 * @cflags: completion flags
324+ * @extra1: extra 64-bit data for CQE32
325+ * @extra2: extra 64-bit data for CQE32
324326 *
325327 */
326328 TRACE_EVENT(io_uring_complete,
327329
328− TP_PROTO(void *ctx, void *req, u64 user_data, int res, unsigned cflags),
330+ TP_PROTO(void *ctx, void *req, u64 user_data, int res, unsigned cflags,
331+ u64 extra1, u64 extra2),
329332
330− TP_ARGS(ctx, req, user_data, res, cflags),
333+ TP_ARGS(ctx, req, user_data, res, cflags, extra1, extra2),
331334
332335 TP_STRUCT__entry (
333336 __field( void *, ctx )
@@ -335,6 +338,8 @@ TRACE_EVENT(io_uring_complete, · 1 unmodified line
335338 __field( u64, user_data )
336339 __field( int, res )
337340 __field( unsigned, cflags )
341+ __field( u64, extra1 )
342+ __field( u64, extra2 )
338343 ),
339344
340345 TP_fast_assign(
@@ -343,12 +348,17 @@ TRACE_EVENT(io_uring_complete, · 2 unmodified lines
343348 __entry->user_data = user_data;
344349 __entry->res = res;
345350 __entry->cflags = cflags;
351+ __entry->extra1 = extra1;
352+ __entry->extra2 = extra2;
346353 ),
347354
348− TP_printk("ring %p, req %p, user_data 0x%llx, result %d, cflags 0x%x",
355+ TP_printk("ring %p, req %p, user_data 0x%llx, result %d, cflags 0x%x "
356+ "extra1 %llu extra2 %llu ",
349357 __entry->ctx, __entry->req,
350358 __entry->user_data,
351− __entry->res, __entry->cflags)
359+ __entry->res, __entry->cflags,
360+ (unsigned long long) __entry->extra1,
361+ (unsigned long long) __entry->extra2)
352362 );
353363
354364 /**