From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52550 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOsNR-0000yH-Hr for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:10:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOsNP-000148-6a for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:09:57 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:40552) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOsNP-00013l-2p for qemu-devel@nongnu.org; Wed, 16 Jun 2010 09:09:55 -0400 Received: by gyd5 with SMTP id 5so4109315gyd.4 for ; Wed, 16 Jun 2010 06:09:54 -0700 (PDT) Message-ID: <4C18CD1D.5040600@codemonkey.ws> Date: Wed, 16 Jun 2010 08:09:49 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH V4 0/3] qemu: Threadlets: A generic task offloading framework References: <20100616115404.10988.62371.stgit@localhost.localdomain> In-Reply-To: <20100616115404.10988.62371.stgit@localhost.localdomain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gautham R Shenoy Cc: Paolo Bonzini , Qemu-development List , Corentin Chary , Avi Kivity On 06/16/2010 06:56 AM, Gautham R Shenoy wrote: > Hi, > > This is the v4 of the patch-series to have a generic asynchronous task > offloading framework (called threadlets) within qemu. > Semantically, a threadlet is identical to a QEMUBH except that a QEMUBH holds the qemu_mutex and a threadlet doesn't. I'd suggest naming these functions similar to QEMUBH to the point where it makes sense to use the same structure. Instead of the normal qemu_bh_schedule, I'd suggest having a qemu_bh_schedule_unlocked(). Also, please introduce a short document in docs/ that gives a brief overview of how to use unlocked bottom halves especially focusing on the considerations with respect to what should and shouldn't be done in these functions. It would be helpful (although optional) to document traditional bottom halves in the same file. Regards, Anthony Liguori > V3 can be found here: > http://lists.gnu.org/archive/html/qemu-devel/2010-06/index.html > > Changes from V3: > ===================================================================== > - Did away with the qemu-thread wrappers for handling pthread_attr_t type > following review comments for V3. > > - Added qemu-thread wrappers for pthread_barrier_init() and > pthread_barrier_wait(). > > - Added a flush_threadlet_queue() helper which allows the caller to wait till > all the queued tasks have finished processing. > > - Added a global queue that can be used by most subsystems to offload tasks. The > flexibility to allow individual subsystems to create their private queue with > associated thread-pool has been retained. > > - Fixed the Copyrights in the newly introduced file to reflect the copyrights of > the borrowed code. > > - Renamed the helper functions to reflect their use. Added comments for each of > the helpers. > > - Typedef'd the structs to adhere to the qemu coding style. > > Description > ===================================================================== > This patch series decouples the asynchronous threading framework > implementation from posix-aio-compat.c to implement a generic asynchronous > task offloading threading framework called threadlets 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. > > This offloading framework can be used by subsystems such as virtio-9p, > Asynchronous encoding for vnc-server, so that the vcpu thread can offload > blocking operations on to the asynchronous threads and resume servicing > any other guest requests. The asynchronous threads, after > finishing the blocking operations can then transfer the control over > to the IO thread so that the latter can handle the post_blocking_operation(). > > The patch series passed fsstress test without any issues. > > Could it be considered for inclusion ? > > --- > > Aneesh Kumar K.V (1): > qemu: Generic task offloading framework: threadlets > > Gautham R Shenoy (2): > qemu: Add qemu-barrier support to qemu-thread framework. > qemu: Convert AIO code to use threadlets. > > > Makefile.objs | 3 + > async-work.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > async-work.h | 69 +++++++++++++++++++ > posix-aio-compat.c | 152 +++++++----------------------------------- > qemu-thread.c | 23 ++++++ > qemu-thread.h | 9 +++ > 6 files changed, 313 insertions(+), 129 deletions(-) > create mode 100644 async-work.c > create mode 100644 async-work.h > >