From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWN8o-0000z2-D0 for qemu-devel@nongnu.org; Fri, 13 Mar 2015 06:48:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YWN8j-0002MG-EQ for qemu-devel@nongnu.org; Fri, 13 Mar 2015 06:48:30 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:43203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YWN8j-0002MB-7S for qemu-devel@nongnu.org; Fri, 13 Mar 2015 06:48:25 -0400 Received: by widem10 with SMTP id em10so4867231wid.2 for ; Fri, 13 Mar 2015 03:48:24 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5502C074.2060807@redhat.com> Date: Fri, 13 Mar 2015 11:48:20 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1426210723-16735-1-git-send-email-famz@redhat.com> <1426210723-16735-5-git-send-email-famz@redhat.com> <55029C22.1070901@redhat.com> <20150313085847.GC3527@ad.nay.redhat.com> In-Reply-To: <20150313085847.GC3527@ad.nay.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 4/4] dma-helpers: Move reschedule_dma BH to blk's AioContext List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org On 13/03/2015 09:58, Fam Zheng wrote: >> > >> > This looks good. However, I wonder if dma_aio_cancel should also call >> > cpu_unregister_map_client. In this case, it's much better to just use a >> > lock for the list (though you can still use atomics for the in-use flag). > The other possibility is grab a reference for the cpu_register_map_client call, > and release it in reschedule_dma. This way the atomics can keep, but we'll need > a "finished" flag in DMAAIOCB to avoid double completion. Considering this is a slow path, a lock seems preferrable. It's not that your patch were bad, it's that a pre-existing bug got in your way, and broke the assumptions you made. Paolo