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
2348 struct io_uring_cqe *cqe;2348 struct io_uring_cqe *cqe;
2349 2349
2350 trace_io_uring_complete(req->ctx, req, req->cqe.user_data,2350 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);
2352 2352
2353 /*2353 /*
2354 * If we can't get a cq entry, userspace overflowed the2354 * 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
2372 u64 extra2 = req->extra2;2372 u64 extra2 = req->extra2;
2373 2373
2374 trace_io_uring_complete(req->ctx, req, req->cqe.user_data,2374 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);
2376 2376
2377 /*2377 /*
2378 * If we can't get a cq entry, userspace overflowed the2378 * 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
2393 2393
2394static inline bool __io_fill_cqe_req(struct io_kiocb *req, s32 res, u32 cflags)2394static inline bool __io_fill_cqe_req(struct io_kiocb *req, s32 res, u32 cflags)
2395{2395{
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);
2397 return __io_fill_cqe(req->ctx, req->cqe.user_data, res, cflags);2397 return __io_fill_cqe(req->ctx, req->cqe.user_data, res, cflags);
2398}2398}
2399 2399
@@ -2408,7 +2408,8 @@ static inline void __io_fill_cqe32_req(struct io_kiocb *req, s32 res, u32 cflags · 8 unmodified lines
2408 if (req->flags & REQ_F_CQE_SKIP)2408 if (req->flags & REQ_F_CQE_SKIP)
2409 return;2409 return;
2410 2410
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);
2412 2413
2413 /*2414 /*
2414 * If we can't get a cq entry, userspace overflowed the2415 * 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
2432 s32 res, u32 cflags)2433 s32 res, u32 cflags)
2433{2434{
2434 ctx->cq_extra++;2435 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);
2436 return __io_fill_cqe(ctx, user_data, res, cflags);2437 return __io_fill_cqe(ctx, user_data, res, cflags);
2437}2438}
2438 2439
include/trace/events/io_uring.h+14−4
@@ -321,13 +321,16 @@ TRACE_EVENT(io_uring_fail_link, · 320 unmodified lines
321 * @user_data: user data associated with the request321 * @user_data: user data associated with the request
322 * @res: result of the request322 * @res: result of the request
323 * @cflags: completion flags323 * @cflags: completion flags
324 * @extra1: extra 64-bit data for CQE32
325 * @extra2: extra 64-bit data for CQE32
324 *326 *
325 */327 */
326TRACE_EVENT(io_uring_complete,328TRACE_EVENT(io_uring_complete,
327 329
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),
329 332
330 TP_ARGS(ctx, req, user_data, res, cflags),333 TP_ARGS(ctx, req, user_data, res, cflags, extra1, extra2),
331 334
332 TP_STRUCT__entry (335 TP_STRUCT__entry (
333 __field( void *, ctx )336 __field( void *, ctx )
@@ -335,6 +338,8 @@ TRACE_EVENT(io_uring_complete, · 1 unmodified line
335 __field( u64, user_data )338 __field( u64, user_data )
336 __field( int, res )339 __field( int, res )
337 __field( unsigned, cflags )340 __field( unsigned, cflags )
341 __field( u64, extra1 )
342 __field( u64, extra2 )
338 ),343 ),
339 344
340 TP_fast_assign(345 TP_fast_assign(
@@ -343,12 +348,17 @@ TRACE_EVENT(io_uring_complete, · 2 unmodified lines
343 __entry->user_data = user_data;348 __entry->user_data = user_data;
344 __entry->res = res;349 __entry->res = res;
345 __entry->cflags = cflags;350 __entry->cflags = cflags;
351 __entry->extra1 = extra1;
352 __entry->extra2 = extra2;
346 ),353 ),
347 354
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 ",
349 __entry->ctx, __entry->req,357 __entry->ctx, __entry->req,
350 __entry->user_data,358 __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)
352);362);
353 363
354/**364/**