On 2015-05-26 18:55, Paolo Bonzini wrote: > From: Stefan Hajnoczi <stefa...@redhat.com> > > 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 <stefa...@redhat.com> > Message-Id: <1417519399-3166-6-git-send-email-stefa...@redhat.com> > Reviewed-by: Fam Zheng <f...@redhat.com> > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > 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 aurel...@aurel32.net http://www.aurel32.net