Skip to content

aio-posix: enable io_uring SINGLE_ISSUER, TASKRUN, and NO_SQARRAY flags

Stefan Hajnoczi qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v1 RFC3 patches 0 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4iothread: create AioContext in iothread_run()include/system/iothread.h iothread.c+78 -630 replies
2/4aio-posix: enable IORING_SETUP_SINGLE_ISSUERutil/fdmon-io_uring.c+19 -10 replies
3/4aio-posix: enable IORING_SETUP_COOP_TASKRUN | IORING_SETUP_TASKRUN_FLAGutil/fdmon-io_uring.c+14 -31 reply
4/4aio-posix: enable IORING_SETUP_NO_SQARRAYutil/fdmon-io_uring.c+3 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] aio-posix: enable io_uring SINGLE_ISSUER, TASKRUN, and NO_SQARRAY flags

These patches enable Linux io_uring flags that can improve performance.

Bernd Schubert mentioned io_uring_setup(2) flags that may improve performance:
- IORING_SETUP_SINGLE_ISSUER: optimization when only 1 thread uses an io_uring context
- IORING_SETUP_COOP_TASKRUN: avoids IPIs
- IORING_SETUP_TASKRUN_FLAG: makes COOP_TASKRUN work with userspace CQ ring polling

Jens Axboe recently confirmed that SINGLE_ISSUER makes sense.

Suraj Shirvankar already started work on SINGLE_ISSUER in the past:
https://lore.kernel.org/qemu-devel/[email protected]/

Where this differs from Suraj's previous work is that I have worked around the need for the main loop AioContext to be shared by multiple threads (vCPU threads and the migration thread).

Here are the performance numbers for fio bs=4k in a 4 vCPU guest with 1 IOThread using a virtio-blk disk backed by a local NVMe drive:

                      IOPS               IOPS              IOPS
Benchmark             SINGLE_ISSUER      +TASKRUN          +NO_SQARRAY
randread  iodepth=1   99108 (+0.33%)     100816 (+2.1%)    104411 (+5.7%)
randread  iodepth=64  276314 (+0.12%)    275939 (-0.012%)  275899 (-0.026%)
randwrite iodepth=1   99997 (-0.11%)     102866 (+2.8%)    105588 (+5.5%)
randwrite iodepth=64  272205 (-0.2%)     271973 (-0.29%)   273257 (+0.18%)

You can find detailed benchmarking results here including the fio output, fio command-line, and guest libvirt domain XML:
https://gitlab.com/stefanha/virt-playbooks/-/tree/io_uring-flags/notebook/fio-output
https://gitlab.com/stefanha/virt-playbooks/-/blob/io_uring-flags/files/fio.sh
https://gitlab.com/stefanha/virt-playbooks/-/blob/io_uring-flags/files/test.xml.j2

Stefan Hajnoczi (4):
iothread: create AioContext in iothread_run()
aio-posix: enable IORING_SETUP_SINGLE_ISSUER
aio-posix: enable IORING_SETUP_COOP_TASKRUN |
IORING_SETUP_TASKRUN_FLAG
aio-posix: enable IORING_SETUP_NO_SQARRAY

 include/system/iothread.h |   1 -
 iothread.c                | 140 +++++++++++++++++++++-----------------
 util/fdmon-io_uring.c     |  38 ++++++++++-
 3 files changed, 113 insertions(+), 66 deletions(-)
Signature · 1 line
2.53.0