From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=35546 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGEuS-0005vG-7O for qemu-devel@nongnu.org; Wed, 10 Nov 2010 12:56:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGEuQ-0006C1-NC for qemu-devel@nongnu.org; Wed, 10 Nov 2010 12:56:35 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:55130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGEuQ-0006Bj-4h for qemu-devel@nongnu.org; Wed, 10 Nov 2010 12:56:34 -0500 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [202.81.31.247]) by e23smtp06.au.ibm.com (8.14.4/8.13.1) with ESMTP id oAAHuURn026465 for ; Thu, 11 Nov 2010 04:56:30 +1100 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAAHuVl72019380 for ; Thu, 11 Nov 2010 04:56:31 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oAAHuVhu011752 for ; Thu, 11 Nov 2010 04:56:31 +1100 Date: Wed, 10 Nov 2010 23:26:20 +0530 From: Arun R Bharadwaj Subject: Re: [Qemu-devel] [PATCH 2/3] Move threadlets infrastructure to qemu-threadlets.c Message-ID: <20101110175620.GB2300@linux.vnet.ibm.com> References: <20101110131822.29714.34137.stgit@localhost6.localdomain6> <20101110131953.29714.21740.stgit@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Reply-To: arun@linux.vnet.ibm.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org * Blue Swirl [2010-11-10 17:29:30]: > On Wed, Nov 10, 2010 at 1:19 PM, Arun R Bharadwaj > wrote: > > The reason for creating this generic infrastructure is so that other = subsystems, > > such as virtio-9p could make use of it for offloading tasks that coul= d block. > > > > Signed-off-by: Arun R Bharadwaj > > Signed-off-by: Aneesh Kumar K.V > > Signed-off-by: Gautham R Shenoy > > Signed-off-by: Sripathi Kodi > > --- > > =A0Makefile.objs =A0 =A0 =A0 =A0 =A0| =A0 =A01 > > =A0docs/async-support.txt | =A0141 ++++++++++++++++++++++++++++++++++= +++++ > > =A0posix-aio-compat.c =A0 =A0 | =A0173 ------------------------------= ------------------ > > =A0qemu-threadlets.c =A0 =A0 =A0| =A0168 ++++++++++++++++++++++++++++= +++++++++++++++++++ > > =A0qemu-threadlets.h =A0 =A0 =A0| =A0 48 +++++++++++++ > > =A05 files changed, 359 insertions(+), 172 deletions(-) > > =A0create mode 100644 docs/async-support.txt > > =A0create mode 100644 qemu-threadlets.c > > =A0create mode 100644 qemu-threadlets.h > > > > diff --git a/qemu-threadlets.h b/qemu-threadlets.h > > new file mode 100644 > > index 0000000..f869304 > > --- /dev/null > > +++ b/qemu-threadlets.h > > @@ -0,0 +1,48 @@ > > +/* > > + * Threadlet support for offloading tasks to be executed asynchronou= sly > > + * > > + * Copyright IBM, Corp. 2008 > > + * Copyright IBM, Corp. 2010 > > + * > > + * Authors: > > + * =A0Anthony Liguori =A0 =A0 > > + * =A0Aneesh Kumar K.V =A0 =A0 > > + * =A0Gautham R Shenoy =A0 =A0 > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2. = =A0See > > + * the COPYING file in the top-level directory. > > + */ > > + > > +#ifndef QEMU_ASYNC_WORK_H > > +#define QEMU_ASYNC_WORK_H > > + > > +#include "qemu-queue.h" > > +#include "qemu-common.h" > > +#include "qemu-thread.h" > > + > > +typedef struct ThreadletQueue > > +{ > > + =A0 =A0QemuMutex lock; > > + =A0 =A0QemuCond cond; > > + =A0 =A0int max_threads; > > + =A0 =A0int min_threads; > > + =A0 =A0int cur_threads; > > + =A0 =A0int idle_threads; > > + =A0 =A0QTAILQ_HEAD(, ThreadletWork) request_list; > > +} ThreadletQueue; > > + > > +typedef struct ThreadletWork > > +{ > > + =A0 =A0QTAILQ_ENTRY(ThreadletWork) node; > > + =A0 =A0void (*func)(struct ThreadletWork *work); > > +} ThreadletWork; > > + > > +extern void submit_work_to_queue(ThreadletQueue *queue, > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Thr= eadletWork *work); > > +extern void submit_work(ThreadletWork *work); > > +extern int dequeue_work_on_queue(ThreadletQueue *queue, > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Thr= eadletWork *work); > > +extern int dequeue_work(ThreadletWork *work); > > +extern void threadlet_queue_init(ThreadletQueue *queue, int max_thre= ads, > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int= min_threads); >=20 > Please remove 'extern' qualifiers, they are useless for function > declarations. In most cases they are not used in QEMU. Will change these. Thanks for the review. -arun