Received: from eggs.gnu.org ([2001:4830:134:3::10]:56245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxwYD-0004F0-AQ for qemu-devel@nongnu.org; Thu, 28 May 2015 08:04:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxwY7-00019N-GP for qemu-devel@nongnu.org; Thu, 28 May 2015 08:04:41 -0400 Date: Thu, 28 May 2015 20:04:23 +0800 From: Fam Zheng Message-ID: <20150528120423.GG8461@dhcp-14-238.nay.redhat.com> References: <55659372.9060804@redhat.com> <20150527101016.GB4669@noname.str.redhat.com> <55659FCC.2030704@redhat.com> <20150528024950.GC22609@dhcp-14-238.nay.redhat.com> <20150528094047.GB3385@noname.redhat.com> <20150528105538.GB8461@dhcp-14-238.nay.redhat.com> <5566F545.9070303@redhat.com> <20150528112439.GD3385@noname.redhat.com> <20150528114454.GE8461@dhcp-14-238.nay.redhat.com> <55670035.1080804@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55670035.1080804@redhat.com> Subject: Re: [Qemu-devel] [PATCH v6 01/13] block: Add op blocker type "device IO" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-block@nongnu.org, armbru@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, Max Reitz , Stefan Hajnoczi , amit.shah@redhat.com On Thu, 05/28 13:47, Paolo Bonzini wrote: > > > On 28/05/2015 13:44, Fam Zheng wrote: > > > The reason for doing it in the block layer is that it's in one place and > > > we can be sure that it's applied. We can still in addition modify > > > specific users to avoid even trying to send requests, but I think it's > > > good to have the single place that always ensures correct functionality > > > of the drain instead of making it dependent on the user. > > > > How to do that for the synchronous blk_write callers that don't run in > > a coroutine? > > They would be completely oblivious to it. > > Their call to blk_co_write would queue the request. Then blk_write > calls aio_poll, which ultimately would result in blk_resume and unqueue > the request. OK.. I thought that, then we have to make a rule that a blk_pause must be resolved by an aio_poll() loop. This is somehow tricky, for example I assume blk_write() would only call aio_poll() of its own AioContext? But the pairing blk_resume() will be in the main context. To make it worse, what if there is no BDS in the main context, should it be special cased in the block layer? Fam