diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2011-03-16 12:09:09 +0200 |
---|---|---|
committer | Justin M. Forbes <jforbes@redhat.com> | 2011-05-03 08:28:58 -0500 |
commit | fc5c4a7a63d80af7f4862e4965dd4ffcaedbf69a (patch) | |
tree | eac8d6eb30bbc5eb861722b542dc3d9456d0f6ff | |
parent | Do not delete BlockDriverState when deleting the drive (diff) | |
download | qemu-kvm-fc5c4a7a63d80af7f4862e4965dd4ffcaedbf69a.tar.gz qemu-kvm-fc5c4a7a63d80af7f4862e4965dd4ffcaedbf69a.tar.bz2 qemu-kvm-fc5c4a7a63d80af7f4862e4965dd4ffcaedbf69a.zip |
vhost: fix dirty page handling
vhost was passing a physical address to cpu_physical_memory_set_dirty,
which is wrong: we need to translate to ram address first.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Note: this lead to crashes during migration, so the patch
is needed on the stable branch too.
-rw-r--r-- | hw/vhost.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/vhost.c b/hw/vhost.c index 38cc3b365..6c194f0f8 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -47,8 +47,10 @@ static void vhost_dev_sync_region(struct vhost_dev *dev, log = __sync_fetch_and_and(from, 0); while ((bit = sizeof(log) > sizeof(int) ? ffsll(log) : ffs(log))) { + ram_addr_t ram_addr; bit -= 1; - cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE); + ram_addr = cpu_get_physical_page_desc(addr + bit * VHOST_LOG_PAGE); + cpu_physical_memory_set_dirty(ram_addr); log &= ~(0x1ull << bit); } addr += VHOST_LOG_CHUNK; |