Skip to content

qemu: Extend AIO threading framework to a generic one.

Gautham R Shenoy qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4qemu: Generic asynchronous threading framework to offload tasksMakefile.objs async-work.c async-work.h+239 -02 replies
2/4qemu: Convert AIO code to use the generic threading infrastructure.posix-aio-compat.c+29 -1260 replies
3/4virtio-9p: Add async helper functionshw/virtio-9p.c+167 -00 replies
4/4virtio-9p: convert lstat to use async infrastructure.hw/virtio-9p.c hw/virtio-9p.h+26 -120 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [Qemu-devel] [RFC/ PATCH 0/4] qemu: Extend AIO threading framework to a generic one.

Hi,

This patch series is strictly RFC only.

It decouples the asynchrnous threading framework implementation from posix-aio-compat.c to implement a generic asynchrnous task offloading threading framework which can be used by other subsystems within QEMU.

Currently within QEMU, the AIO subsystem (paio) creates a bunch of asynchronous threads to offload any blocking operations so that the vcpu threads and the IO thread can go back to servicing any other guest requests.

We would want to make use of this offloading framework in case of the virtio-9p subsystem, where so that the vcpu thread can offload POSIX operations on to the asynchronous threads and resume servicing any other guest requests. The asynchrnous threads, after finishing the POSIX operations can then transfer the control over to the IO thread so that the latter can handle the post_posix_operation().

The post_posix_operation() could in turn offload more work to be handled by the asynnchronous thread pool or sends the results of the operation to the guest.

The patch series also implements a patch that converts v9fs_stat() call to make use of the asynchrnous threading framework. This is an example of how the other calls could be converted eventually.

I had a doubt with respect to the original code where the communication between the asynchronous aio threads and the io-thread occurs.

In posix-aio-compat.c, we do not do a write(wfd) from the context of the asynchrnous thread, but instead send a SIGUSR2, the handler of which does a write(wfd), thereby causing the iothread blocked on select() to unblock.

Why do we send a signal, and not execute whatever aio_signal_handler() is from the context of the asynchronous thread ? Is it to ensure that the io-thread does not miss any write(wfd) ?

In this patch series, I have made the virtio-9p make use of SIGUSR1 to mimic similar behaviour. This is just a temporary piece of code to get virtio-9p use the async framework for now.

The patch series passed fsstress test without any issues.

Awaiting your comments.
---

Aneesh Kumar K.V (1):
qemu: Generic asynchronous threading framework to offload tasks

Gautham R Shenoy (3):
qemu: Convert AIO code to use the generic threading infrastructure.
virtio-9p: Add async helper functions
virtio-9p: convert lstat to use async infrastructure.

 Makefile.objs      |    2 +
 async-work.c       |  152 +++++++++++++++++++++++++++++++++++++++++
 async-work.h       |   85 +++++++++++++++++++++++
 hw/virtio-9p.c     |  195 ++++++++++++++++++++++++++++++++++++++++++++++++++--
 hw/virtio-9p.h     |    4 +
 posix-aio-compat.c |  155 ++++++++---------------------------------
 6 files changed, 458 insertions(+), 135 deletions(-)
 create mode 100644 async-work.c
 create mode 100644 async-work.h
Signature · 2 lines
Thanks and Regards
gautham.