Received: from eggs.gnu.org ([2001:4830:134:3::10]:35858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwtJ-0007bG-KP for qemu-devel@nongnu.org; Thu, 28 May 2015 08:26:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwtF-0001KI-Oh for qemu-devel@nongnu.org; Thu, 28 May 2015 08:26:29 -0400 Date: Thu, 28 May 2015 20:26:14 +0800 From: Fam Zheng Message-ID: <20150528122614.GI8461@dhcp-14-238.nay.redhat.com> References: <1432711146-28405-1-git-send-email-famz@redhat.com> <556590B1.2040405@redhat.com> <20150528014615.GA22609@dhcp-14-238.nay.redhat.com> <5566D000.3030101@redhat.com> <20150528111656.GD8461@dhcp-14-238.nay.redhat.com> <5566F9A8.4020702@redhat.com> <20150528114901.GF8461@dhcp-14-238.nay.redhat.com> <5567039E.2020509@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5567039E.2020509@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 0/4] aio: Don't poll ioeventfd in nested aio_poll() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-block@nongnu.org, "Michael S. Tsirkin" , Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi On Thu, 05/28 14:01, Paolo Bonzini wrote: > > > On 28/05/2015 13:49, Fam Zheng wrote: > > On Thu, 05/28 13:19, Paolo Bonzini wrote: > >> > >> > >> On 28/05/2015 13:16, Fam Zheng wrote: > >>>> On 28/05/2015 03:46, Fam Zheng wrote: > >>>>> The main context uses iohandler and aio_dispatch, neither calls > >>>>> aio_set_dispatching(). However, if we have [2], they can be changed to > >>>>> aio_poll(), then would this idea work? > >>>> > >>>> I think it's a bad idea to handle aio_poll for context B in a different > >>>> way, just because you have an outer aio_poll for context A... > >>> > >>> But we already do something similar: ignoring slirp, main_loop_wait() is like > >>> an iothread aio_poll() without the "outermost differentiation", while the > >>> current aio_poll() in bdrv_drain() is roughly "main_loop_wait() minus > >>> iohandlers". > >> > >> Right, but the two sets of iohandlers are stored in different places, so > >> it's obvious that you don't execute all of them. On the other hand, > >> examining global state in aio_poll is really bad. > >> > > > > OK. > > > > Would moving the ioeventfds to a new top level aio_loop_wait() be any better? > > That way no global state is needed. > > If we need pause/resume anyway due to block/mirror.c's use of > block_job_defer_to_main_loop, I think this is not a problem anymore? > I also hope to dedup the iohandler code with async.c, on top of [2]; and in the longer term, convert slirp to use AioContext API too, so that all *_pollfds_fill() will not be necessary - the whole event loop goes epoll style. Fam