From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NvBNP-0005bG-QA for qemu-devel@nongnu.org; Fri, 26 Mar 2010 11:23:11 -0400 Received: from [140.186.70.92] (port=38005 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NvBNO-0005Zs-LO for qemu-devel@nongnu.org; Fri, 26 Mar 2010 11:23:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NvBNM-00009L-PW for qemu-devel@nongnu.org; Fri, 26 Mar 2010 11:23:10 -0400 Received: from mx20.gnu.org ([199.232.41.8]:58776) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NvBNM-00009H-Mw for qemu-devel@nongnu.org; Fri, 26 Mar 2010 11:23:08 -0400 Received: from mail.codesourcery.com ([38.113.113.100]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NvBNM-00005E-5r for qemu-devel@nongnu.org; Fri, 26 Mar 2010 11:23:08 -0400 From: Paul Brook Subject: Re: [Qemu-devel] [patch 1/2] Pass QEMUIOWorker to qemu_notify_event Date: Fri, 26 Mar 2010 15:23:03 +0000 References: <20100325134715.354365213@amt.cnet> <201003252106.01194.paul@codesourcery.com> <20100326035558.GA20616@amt.cnet> In-Reply-To: <20100326035558.GA20616@amt.cnet> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201003261523.03617.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, Anthony Liguori , Marcelo Tosatti > On Thu, Mar 25, 2010 at 09:06:00PM +0000, Paul Brook wrote: > > > /* Force QEMU to process pending events */ > > > -void qemu_notify_event(void); > > > +void qemu_notify_event(QEMUIOWorker *worker); > > > > > > static void handle_input(VirtIODevice *vdev, VirtQueue *vq) > > > { > > > + qemu_notify_event(main_io_worker); > > > } > > > > This feels completely wrong. > > > > Devices shouldn't know or care about implementation details like this. > > How is a device supposed to know which worker it should be waking up? > > Its not. It could use qemu_notify_event(DeviceInfo->worker), and have no > knowledge of the internals. In that case I think you're abusing this API. I'm very wary of introducing random bits of code that allegedly allow future use of threads. Exploiting thread level parallelism is a hard problem that needs proper design. A such I object to this patch, and think we first need to decide what form of concurrency model we want to use in QEMU. Paul