Patchwork [28/30] fix memory.c

login
register
mail settings
Submitter Juan Quintela
Date Oct. 18, 2012, 7:30 a.m.
Message ID <1350545426-23172-29-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/192232/
State New
Headers show

Comments

Juan Quintela - Oct. 18, 2012, 7:30 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 memory.c | 4 +++-
 memory.h | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Paolo Bonzini - Oct. 18, 2012, 8:43 a.m.
Il 18/10/2012 09:30, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  memory.c | 4 +++-
>  memory.h | 3 ++-
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/memory.c b/memory.c
> index 126fb63..4d0fa96 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1089,7 +1089,9 @@ bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
>      ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size,
>                                          1 << client);
>      if (ret) {
> -        cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
> +        cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
> +                                        mr->ram_addr + addr + size,
> +                                        1 << client);
>      }
>      return ret;
>  }
> diff --git a/memory.h b/memory.h
> index 08af012..0dcc0f4 100644
> --- a/memory.h
> +++ b/memory.h
> @@ -449,7 +449,8 @@ void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
>   */
>  bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
>                                          target_phys_addr_t addr,
> -                                        target_phys_addr_t size, unsigned client)
> +                                        target_phys_addr_t size,
> +                                        unsigned client);
>  /**
>   * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
>   *                                  any external TLBs (e.g. kvm)
> 

This should be squashed in patch 26.

Paolo

Patch

diff --git a/memory.c b/memory.c
index 126fb63..4d0fa96 100644
--- a/memory.c
+++ b/memory.c
@@ -1089,7 +1089,9 @@  bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
     ret = cpu_physical_memory_get_dirty(mr->ram_addr + addr, size,
                                         1 << client);
     if (ret) {
-        cpu_physical_memory_set_dirty_range(mr->ram_addr + addr, size, -1);
+        cpu_physical_memory_reset_dirty(mr->ram_addr + addr,
+                                        mr->ram_addr + addr + size,
+                                        1 << client);
     }
     return ret;
 }
diff --git a/memory.h b/memory.h
index 08af012..0dcc0f4 100644
--- a/memory.h
+++ b/memory.h
@@ -449,7 +449,8 @@  void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
  */
 bool memory_region_test_and_clear_dirty(MemoryRegion *mr,
                                         target_phys_addr_t addr,
-                                        target_phys_addr_t size, unsigned client)
+                                        target_phys_addr_t size,
+                                        unsigned client);
 /**
  * memory_region_sync_dirty_bitmap: Synchronize a region's dirty bitmap with
  *                                  any external TLBs (e.g. kvm)