From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZG5l0-0002ub-JN for qemu-devel@nongnu.org; Fri, 17 Jul 2015 09:32:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZG5kw-0005Cp-Cj for qemu-devel@nongnu.org; Fri, 17 Jul 2015 09:32:54 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:38313) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZG5kw-0005Ch-79 for qemu-devel@nongnu.org; Fri, 17 Jul 2015 09:32:50 -0400 Received: by wicmv11 with SMTP id mv11so42914767wic.1 for ; Fri, 17 Jul 2015 06:32:49 -0700 (PDT) References: <1436516626-8322-1-git-send-email-a.rigo@virtualopensystems.com> <1436516626-8322-8-git-send-email-a.rigo@virtualopensystems.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1436516626-8322-8-git-send-email-a.rigo@virtualopensystems.com> Date: Fri, 17 Jul 2015 14:32:47 +0100 Message-ID: <87a8uu6ha8.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [RFC v3 07/13] ram_addr.h: Make exclusive bitmap accessors atomic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alvise Rigo Cc: mttcg@listserver.greensocs.com, claudio.fontana@huawei.com, qemu-devel@nongnu.org, pbonzini@redhat.com, jani.kokkonen@huawei.com, tech@virtualopensystems.com Alvise Rigo writes: > Suggested-by: Jani Kokkonen > Suggested-by: Claudio Fontana > Signed-off-by: Alvise Rigo > --- > include/exec/ram_addr.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h > index 2766541..e51bd65 100644 > --- a/include/exec/ram_addr.h > +++ b/include/exec/ram_addr.h > @@ -255,7 +255,7 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(unsigned long *dest, > /* Exclusive bitmap accessors. */ > static inline void cpu_physical_memory_set_excl_dirty(ram_addr_t addr) > { > - set_bit(addr >> TARGET_PAGE_BITS, > + set_bit_atomic(addr >> TARGET_PAGE_BITS, > ram_list.dirty_memory[DIRTY_MEMORY_EXCLUSIVE]); > } > > @@ -267,8 +267,8 @@ static inline int cpu_physical_memory_excl_is_dirty(ram_addr_t addr) > > static inline void cpu_physical_memory_clear_excl_dirty(ram_addr_t addr) > { > - clear_bit(addr >> TARGET_PAGE_BITS, > - ram_list.dirty_memory[DIRTY_MEMORY_EXCLUSIVE]); > + bitmap_test_and_clear_atomic(ram_list.dirty_memory[DIRTY_MEMORY_EXCLUSIVE], > + addr >> TARGET_PAGE_BITS, 1); Does this call for simply implementing a clear_bit_atomic() rather than the fancy bitmap_test_and_clear_atomic. Looking at atomic.h it seems the primitives you need are there. > } > > #endif -- Alex Bennée