From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40036 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOuq7-0007mo-As for qemu-devel@nongnu.org; Wed, 16 Jun 2010 11:47:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOuq5-0004iN-G0 for qemu-devel@nongnu.org; Wed, 16 Jun 2010 11:47:43 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:63705) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOuq5-0004iI-9T for qemu-devel@nongnu.org; Wed, 16 Jun 2010 11:47:41 -0400 Received: by fxm9 with SMTP id 9so665995fxm.4 for ; Wed, 16 Jun 2010 08:47:40 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4C18EBC4.4040603@linux.vnet.ibm.com> References: <20100616115404.10988.62371.stgit@localhost.localdomain> <20100616115656.10988.96529.stgit@localhost.localdomain> <4C18C4C8.8090901@redhat.com> <20100616142236.GA20052@shareable.org> <4C18DFD7.1090102@redhat.com> <4C18E1E8.3030606@linux.vnet.ibm.com> <4C18E52B.9010600@redhat.com> <4C18EBC4.4040603@linux.vnet.ibm.com> Date: Wed, 16 Jun 2010 17:47:39 +0200 Message-ID: Subject: Re: [Qemu-devel] Re: [PATCH V4 2/3] qemu: Generic task offloading framework: threadlets From: Corentin Chary Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Gautham R Shenoy , Qemu-development List , Avi Kivity , Paolo Bonzini , "Aneesh Kumar K.V" On Wed, Jun 16, 2010 at 5:20 PM, Anthony Liguori wrote: > On 06/16/2010 09:52 AM, Paolo Bonzini wrote: >> >> On 06/16/2010 04:38 PM, Anthony Liguori wrote: >>> >>> On 06/16/2010 09:29 AM, Paolo Bonzini wrote: >>>> >>>> On 06/16/2010 04:22 PM, Jamie Lokier wrote: >>>>> >>>>> Paolo Bonzini wrote: >>>>>> >>>>>> These should be (at least for now) block-obj-$(CONFIG_POSIX). >>>>>> >>>>>>> + while (QTAILQ_EMPTY(&(queue->request_list))&& >>>>>>> + (ret !=3D ETIMEDOUT)) { >>>>>>> + ret =3D qemu_cond_timedwait(&(queue->cond), >>>>>>> + &(queue->lock), 10*100000); >>>>>>> + } >>>>>> >>>>>> Using qemu_cond_timedwait is a hack for not properly broadcasting th= e >>>>>> condvar in flush_threadlet_queue. >>>>> >>>>> Are you sure? It looks like it also expires idle threads after a >>>>> fixed amount of idle time. >>>> >>>> Unnecessary idle threads are immediately expired as soon as the >>>> threadlet exits if ncecessary, since here >>> >>> If a threadlet is waiting to consume more work, unless we do a >>> pthread_cancel (I dislike cancellation) it will keep waiting until it >>> gets more work (which would mean it's not actually idle)... >> >> Agreed---no cancellation, please. >> >> BTW it's obviously okay with signaling the condition when a threadlet is >> submitted. =A0But when something affects all queue's workers >> (flush_threadlet_queue) you want a broadcast and using expiration as a >> substitute is fishy. > > IMHO, there shouldn't be a need for flush_threadlet_queue. =A0It doesn't = look > used in the aio conversion and if virtio-9p needs it, I suspect something= is > wrong. > I would need something like flush_threadlet_queue for the vnc server. I need it in vnc_disconnect(), vnc_dpy_resize() and vnc_dpy_cpy() so wait (and/or abort) current encoding jobs. --=20 Corentin Chary http://xf.iksaif.net