From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8qC4-0001nk-Uv for qemu-devel@nongnu.org; Wed, 28 Sep 2011 05:12:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8qBz-0007rq-8Z for qemu-devel@nongnu.org; Wed, 28 Sep 2011 05:12:44 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:43263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8qBy-0007rj-Ti for qemu-devel@nongnu.org; Wed, 28 Sep 2011 05:12:39 -0400 Received: by yib2 with SMTP id 2so7877741yib.4 for ; Wed, 28 Sep 2011 02:12:38 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4E823EEE.3030807@codemonkey.ws> References: <1317133583-25212-1-git-send-email-avi@redhat.com> <4E81EB8A.3070202@siemens.com> <4E81F43B.1040708@codemonkey.ws> <4E81FC29.9090503@redhat.com> <4E823EEE.3030807@codemonkey.ws> Date: Wed, 28 Sep 2011 10:12:38 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] event_notifier: move to top-level directory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Kevin Wolf , Paolo Bonzini , Avi Kivity , qemu-devel@nongnu.org, Jan Kiszka On Tue, Sep 27, 2011 at 10:23 PM, Anthony Liguori w= rote: > On 09/27/2011 11:39 AM, Paolo Bonzini wrote: >> >> On 09/27/2011 06:05 PM, Anthony Liguori wrote: >>> >>> Actually, for posix-aio, we can just switch to using g_idle_add(). >>> g_idle_add() uses g_source_attach which is thread safe. g_idle_add() >>> gives you a thread safe mechanism to defer a piece of work to the >>> main loop which is really what we want here. >> >> For that, a bottom half would also do (apart that I am not sure it is >> async-safe with TCG). In fact, that would make sense since all of >> posix_aio_process_queue could become a bottom half. > > Bottom halves are signal safe, not thread safe. > > To make bottom halves thread safe, you would (in the very least) have to = add > some barriers when reading/writing the scheduling flag. =A0I think it's m= uch > better to just use GIdle sources though. > >>> This can actually be made to work with sync I/O emulation too by >>> having another GMainLoop in the sync I/O loop although I thought I >>> recalled a patch series to remove that stuff. >> >> ... which stuff? :) > > The sync I/O emulation. =A0Since sync I/O is done in block drivers, they = can > just use coroutine I/O instead of sync I/O. Yes, I think we should covert sync I/O code to use coroutines, which is quite natural. The users of sync I/O today are: 1. Hardware emulation - lesser-used or not performance-critical code paths still use bdrv_read/write() in places, e.g. sd, nand, fdc, ide pio. 2. Block drivers. Some image formats are synchronous, but converting to coroutines is pretty easy. 3. qemu-tools including qemu-img and qemu-io. With Paolo's work to make the event loop available in qemu-tools it should be possible to convert and eliminate synchronous I/O interfaces. Stefan