From c011bf1292f14ec2bb05fa37a492509dc8640fdd Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Wed, 23 Nov 2022 16:57:37 +0530 Subject: [PATCH] engines:io_uring: fix clat calculation for sqthread poll When sqthread_poll is specified for io_uring and io_uring_cmd I/O engines, fio reports garbage value for completion latencies. This is because the issue time was not recorded. Added a change for that. On the other hand submission latency for sqthread poll is really just the time it takes to fill in the SQ ring entries and any syscall required to wake up the idle kernel thread. So there is really no need to report those. This fixes the issue: https://github.com/axboe/fio/issues/1484 Signed-off-by: Ankit Kumar Signed-off-by: Vincent Fu --- engines/io_uring.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/engines/io_uring.c b/engines/io_uring.c index 3c656b77..a9abd11d 100644 --- a/engines/io_uring.c +++ b/engines/io_uring.c @@ -637,12 +637,16 @@ static int fio_ioring_commit(struct thread_data *td) */ if (o->sqpoll_thread) { struct io_sq_ring *ring = &ld->sq_ring; + unsigned start = *ld->sq_ring.head; unsigned flags; flags = atomic_load_acquire(ring->flags); if (flags & IORING_SQ_NEED_WAKEUP) io_uring_enter(ld, ld->queued, 0, IORING_ENTER_SQ_WAKEUP); + fio_ioring_queued(td, start, ld->queued); + io_u_mark_submit(td, ld->queued); + ld->queued = 0; return 0; } @@ -804,6 +808,14 @@ static int fio_ioring_queue_init(struct thread_data *td) p.flags |= IORING_SETUP_SQ_AFF; p.sq_thread_cpu = o->sqpoll_cpu; } + + /* + * Submission latency for sqpoll_thread is just the time it + * takes to fill in the SQ ring entries, and any syscall if + * IORING_SQ_NEED_WAKEUP is set, we don't need to log that time + * separately. + */ + td->o.disable_slat = 1; } /* @@ -876,6 +888,14 @@ static int fio_ioring_cmd_queue_init(struct thread_data *td) p.flags |= IORING_SETUP_SQ_AFF; p.sq_thread_cpu = o->sqpoll_cpu; } + + /* + * Submission latency for sqpoll_thread is just the time it + * takes to fill in the SQ ring entries, and any syscall if + * IORING_SQ_NEED_WAKEUP is set, we don't need to log that time + * separately. + */ + td->o.disable_slat = 1; } if (o->cmd_type == FIO_URING_CMD_NVME) { p.flags |= IORING_SETUP_SQE128; -- 2.25.1