Received: from eggs.gnu.org ([2001:4830:134:3::10]:46865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRe4u-0007jb-Rz for qemu-devel@nongnu.org; Wed, 10 Sep 2014 05:20:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRe4o-0002Ba-O7 for qemu-devel@nongnu.org; Wed, 10 Sep 2014 05:20:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19438) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRe4o-0002BP-FI for qemu-devel@nongnu.org; Wed, 10 Sep 2014 05:20:34 -0400 Date: Wed, 10 Sep 2014 17:20:15 +0800 From: Fam Zheng Message-ID: <20140910092015.GA5620@fam-t430.nay.redhat.com> References: <1410328814-12560-1-git-send-email-famz@redhat.com> <54101537.1010905@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <54101537.1010905@huawei.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 00/22] block: Asynchronous request cancellation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bin Wu Cc: Kevin Wolf , Benoit Canet , Peter Lieven , qemu-devel@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , Liu Yuan On Wed, 09/10 17:09, Bin Wu wrote: > On 2014/9/10 13:59, Fam Zheng wrote: > >v5: Fix IDE callback. (Paolo) > > Fix blkdebug. (Paolo) > > Drop the DMA fix which is independent of this series. (Paolo) > > Incorperate Yuan's patch on quorum_aio_cancel. (Beno=EEt) > > Commit message wording fix. (Beno=EEt) > > Rename qemu_aio_release to qemu_aio_unref. (Beno=EEt) > > > >v4: Drop AIOCBInfo.cancel. > > > >This series adds a new block layer API: > > > > void bdrv_aio_cancel_async(BlockDriverAIOCB *acb); > > > >And use it to emulate bdrv_aio_cancel. > > > >The function is similar to bdrv_aio_cancel in that it cancels an AIO r= equest, > >but different that it doesn't block until the request is completely ca= ncelled > >or done. > > > >More importantly, the completion callback, BlockDriverAIOCB.cb, is gua= ranteed > >to be called, so that the cb can take care of resource releasing and s= tatus > >reporting to guest, etc. > > > >In the following work, scsi emulation code will be shifted to use the = async > >cancelling. > > > >One major benefit would be that when guest tries to cancel a request, = where the > >request cannot be cancelled easily, (due to throttled BlockDriverState= , a lost > >connection, or a large request queue), we don't need to block the whol= e vm with > >a busy loop, which is how bdrv_aio_cancel is implemented now. >=20 > First, I think this series is really useful. However, I tested the v4 s= eries > and found virtio-scsi disk(scsi-hd) was still blocked when the IO could= not > come back because of virtio_scsi_do_tmf->scsi_cancel_io->bdrv_aio_cance= l. > can we just change the bdrv_aio_cancel to bdrv_aio_cancel_async to solv= e > this problem? We can't just change it yet. We need to take care of the scsi_req_unref t= here, if we unref right after bdrv_aio_cancel_async, in the cb it will access dangling pointer. It's not trivial enough to do in this series, I will work on that on top,= as said below. For now, the user visible behavior of io cancellation is stil= l the same. Thanks for testing. Fam > > > >Later, we will change scsi device code to make this asynchronous, on t= op of > >bdrv_aio_cancel_async.