From 85f240605d1a46de1fc8609f8e64b994f4716adb Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Tue, 14 Jan 2014 15:07:46 +0100 Subject: [PATCH 35/40] kvm: use directly cpu_physical_memory_* api for tracking dirty pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RH-Author: Juan Quintela Message-id: <1389712071-23303-36-git-send-email-quintela@redhat.com> Patchwork-id: 56690 O-Subject: [RHEL7 qemu-kvm PATCH 35/40] kvm: use directly cpu_physical_memory_* api for tracking dirty pages Bugzilla: 997559 RH-Acked-by: Paolo Bonzini RH-Acked-by: Orit Wasserman RH-Acked-by: Dr. David Alan Gilbert (git) Performance is important in this function, and we want to optimize even further. Signed-off-by: Juan Quintela Reviewed-by: Orit Wasserman (cherry picked from commit 747afd5bcdc90f608c75d95f8a629a9cfc838c57) Conflicts: kvm-all.c Due to upstream commits: commit dd1750d7981cf9e38985c9dfa474dcdbbe236270 Author: Andreas Färber Date: Wed May 1 13:45:44 2013 +0200 kvm: Change kvm_cpu_synchronize_state() argument to CPUState Signed-off-by: Juan Quintela --- kvm-all.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Signed-off-by: Miroslav Rezanina --- kvm-all.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 0e21494..8e2bd34 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -31,6 +31,7 @@ #include "sysemu/kvm.h" #include "qemu/bswap.h" #include "exec/memory.h" +#include "exec/ram_addr.h" #include "exec/address-spaces.h" #include "qemu/event_notifier.h" #include "trace.h" @@ -367,6 +368,7 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, unsigned int i, j; unsigned long page_number, c; hwaddr addr, addr1; + ram_addr_t ram_addr; unsigned int len = ((section->size / getpagesize()) + HOST_LONG_BITS - 1) / HOST_LONG_BITS; unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE; @@ -383,8 +385,9 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section, page_number = (i * HOST_LONG_BITS + j) * hpratio; addr1 = page_number * TARGET_PAGE_SIZE; addr = section->offset_within_region + addr1; - memory_region_set_dirty(section->mr, addr, - TARGET_PAGE_SIZE * hpratio); + ram_addr = section->mr->ram_addr + addr; + cpu_physical_memory_set_dirty_range(ram_addr, + TARGET_PAGE_SIZE * hpratio); } while (c != 0); } } -- 1.7.1