From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxNW4-0007A8-CW for qemu-devel@nongnu.org; Tue, 26 May 2015 18:40:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YxNW3-0000nR-G2 for qemu-devel@nongnu.org; Tue, 26 May 2015 18:40:08 -0400 Received: from hall.aurel32.net ([2001:bc8:30d7:101::1]:51958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxNW3-0000hX-A9 for qemu-devel@nongnu.org; Tue, 26 May 2015 18:40:07 -0400 Date: Wed, 27 May 2015 00:40:03 +0200 From: Aurelien Jarno Message-ID: <20150526224003.GD12677@aurel32.net> References: <1432659305-54578-1-git-send-email-pbonzini@redhat.com> <1432659305-54578-28-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1432659305-54578-28-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 27/29] memory: replace cpu_physical_memory_reset_dirty() with test-and-clear List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, Stefan Hajnoczi On 2015-05-26 18:55, Paolo Bonzini wrote: > From: Stefan Hajnoczi > > The cpu_physical_memory_reset_dirty() function is sometimes used > together with cpu_physical_memory_get_dirty(). This is not atomic since > two separate accesses to the dirty memory bitmap are made. > > Turn cpu_physical_memory_reset_dirty() and > cpu_physical_memory_clear_dirty_range_type() into the atomic > cpu_physical_memory_test_and_clear_dirty(). > > Signed-off-by: Stefan Hajnoczi > Message-Id: <1417519399-3166-6-git-send-email-stefanha@redhat.com> > Reviewed-by: Fam Zheng > Signed-off-by: Paolo Bonzini > --- > cputlb.c | 4 ++-- > exec.c | 23 +++++++++++++++++------ > include/exec/ram_addr.h | 33 ++++++++++----------------------- > memory.c | 11 ++++------- > 4 files changed, 33 insertions(+), 38 deletions(-) ... > diff --git a/exec.c b/exec.c > index 4cd18ff..7552363 100644 > --- a/exec.c > +++ b/exec.c > @@ -856,16 +856,27 @@ static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) > } > > /* Note: start and end must be within the same ram block. */ > -void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t length, > - unsigned client) > +bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start, > + ram_addr_t length, > + unsigned client) > { > - if (length == 0) > - return; > - cpu_physical_memory_clear_dirty_range_type(start, length, client); > + unsigned long end, page; > + bool dirty; > + ^ git am complains about the above added space. -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net