From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nv0jo-0008Nb-NH for qemu-devel@nongnu.org; Fri, 26 Mar 2010 00:01:36 -0400 Received: from [140.186.70.92] (port=52526 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nv0jm-0008NT-Nh for qemu-devel@nongnu.org; Fri, 26 Mar 2010 00:01:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nv0jl-0002fx-9w for qemu-devel@nongnu.org; Fri, 26 Mar 2010 00:01:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29919) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nv0jl-0002ft-0L for qemu-devel@nongnu.org; Fri, 26 Mar 2010 00:01:33 -0400 Date: Fri, 26 Mar 2010 00:55:59 -0300 From: Marcelo Tosatti Subject: Re: [Qemu-devel] [patch 1/2] Pass QEMUIOWorker to qemu_notify_event Message-ID: <20100326035558.GA20616@amt.cnet> References: <20100325134715.354365213@amt.cnet> <20100325134957.646980309@amt.cnet> <201003252106.01194.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201003252106.01194.paul@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: amit.shah@redhat.com, Anthony Liguori , qemu-devel@nongnu.org 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. > qemu_notify_event is an ugly hack to workaround the fact that our character > device API is polled. If shouldn't exist in the first place, instead we should > have a proper mechanism for device emulation to notify the CharDriverState > when it is ready to recieve more data. qemu_notify_event is used to break the main_loop_wait out of select(), to reprocess events that are handled by it (such as ability to receive more data). Perhaps it is appropriate to move that notification to another level, but there are other users of it at device level already.