engines:io_uring: fix clat calculation for sqthread poll
authorAnkit Kumar <ankit.kumar@samsung.com>
Wed, 23 Nov 2022 11:27:37 +0000 (16:57 +0530)
committerVincent Fu <vincent.fu@samsung.com>
Wed, 23 Nov 2022 19:06:03 +0000 (14:06 -0500)
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 <ankit.kumar@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
engines/io_uring.c

index 3c656b773a58740a31a71a70874c5dbb2accd34a..a9abd11dfc7c9805a7f4b4430df623a5c3187747 100644 (file)
@@ -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;