From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKmR2-0002RN-Ay for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:51:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKmQw-0003sn-6C for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:51:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKmQv-0003sc-VX for qemu-devel@nongnu.org; Fri, 22 Aug 2014 06:51:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7MAp18t018049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 22 Aug 2014 06:51:01 -0400 Date: Fri, 22 Aug 2014 18:51:16 +0800 From: Fam Zheng Message-ID: <20140822105116.GA704@T430.nay.redhat.com> References: <1408622216-9578-1-git-send-email-famz@redhat.com> <1408622216-9578-2-git-send-email-famz@redhat.com> <53F5E289.8050703@redhat.com> <20140822012336.GB3410@T430.redhat.com> <53F6FBFF.1010504@redhat.com> <20140822093758.GA24795@T430.nay.redhat.com> <53F7171B.5050702@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53F7171B.5050702@redhat.com> Subject: Re: [Qemu-devel] [RFC PATCH 1/9] block: Add bdrv_aio_cancel_async List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi On Fri, 08/22 12:10, Paolo Bonzini wrote: > Il 22/08/2014 11:37, Fam Zheng ha scritto: > > Exactly. I'd rather not change the contract then. > > > > Alternatively, we may add a refcnt field to BlockDriverAioCB and grab one before > > calling .cancel, so the qemu_aio_release will not free it. > > Yes, and I don't exclude that sooner or later we'll have to add > reference counts to AIOCB anyway. However, reference counting is not > _that_ cheap so for now I'd rather see other solutions explored. Why doesn it have an performance effect? Just because of the would-be "if (likely(--acb->refcnt == 0))" testing? > > The problem is implementing cancel_sync in terms of cancel. The > simplest solution, for now, is to make bdrv_aio_cancel_async return > false if the callback is not implemented, and fall back to synchronous > cancellation. This does keep the code change local, but not necessarily simple, since there would be two cancelling code paths in scsi-bus. I already find the scsi req ref/unref pairs a bit hard to track. I prefer that we change the implementation to avoid complicating interface: don't call qemu_aio_release in .cancel, but call it in bdrv_aio_cancel{,_async} after calling .cancel(). Does that work? Fam