Patchwork Fix KVM dirty logging with 32-bit qemu & >32-bit physical addresses

login
register
mail settings
Submitter Benjamin Herrenschmidt
Date Dec. 23, 2011, 12:15 a.m.
Message ID <1324599306.6632.13.camel@pasglop>
Download mbox | patch
Permalink /patch/132921/
State New
Headers show

Comments

Benjamin Herrenschmidt - Dec. 23, 2011, 12:15 a.m.
We were using the wrong types in kvm_get_dirty_pages_log_range().

This would break dirty logging if the region to log resides at a
physical address above 32-bit, which can happen with 64-bit guest
but also with 32-bit guests that support >32-bit physical addresses
such as ppc BookE.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 kvm-all.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
Alexander Graf - Dec. 23, 2011, 1:53 p.m.
On 23.12.2011, at 01:15, Benjamin Herrenschmidt wrote:

> We were using the wrong types in kvm_get_dirty_pages_log_range().
> 
> This would break dirty logging if the region to log resides at a
> physical address above 32-bit, which can happen with 64-bit guest
> but also with 32-bit guests that support >32-bit physical addresses
> such as ppc BookE.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Acked-by: Alexander Graf <agraf@suse.de>


Alex

Patch

diff --git a/kvm-all.c b/kvm-all.c
index 4c466d6..91b0694 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -328,13 +328,14 @@  static int kvm_set_migration_log(int enable)
 }
 
 /* get kvm's dirty pages bitmap and update qemu's */
-static int kvm_get_dirty_pages_log_range(unsigned long start_addr,
+static int kvm_get_dirty_pages_log_range(target_phys_addr_t start_addr,
                                          unsigned long *bitmap,
-                                         unsigned long offset,
+                                         target_phys_addr_t offset,
                                          unsigned long mem_size)
 {
     unsigned int i, j;
-    unsigned long page_number, addr, addr1, c;
+    unsigned long page_number, c;
+    target_phys_addr_t addr, addr1;
     ram_addr_t ram_addr;
     unsigned int len = ((mem_size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) /
         HOST_LONG_BITS;