From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=44394 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGX9a-0004VF-UF for qemu-devel@nongnu.org; Mon, 24 May 2010 08:53:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGX9Y-00070T-Tm for qemu-devel@nongnu.org; Mon, 24 May 2010 08:53:10 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:41200) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGX9Y-0006zt-2T for qemu-devel@nongnu.org; Mon, 24 May 2010 08:53:08 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp08.in.ibm.com (8.14.3/8.13.1) with ESMTP id o4OBo0K2018045 for ; Mon, 24 May 2010 17:20:00 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o4OCqxYe3424384 for ; Mon, 24 May 2010 18:22:59 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o4OCqw2X019475 for ; Mon, 24 May 2010 22:52:59 +1000 From: Gautham R Shenoy Date: Mon, 24 May 2010 18:22:58 +0530 Message-ID: <20100524125220.29646.62160.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [RFC/ PATCH 0/4] qemu: Extend AIO threading framework to a generic one. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu-development List Cc: Anthony Liguori , Avi Kivity 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 -- Thanks and Regards gautham.