[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/62] kvm: remove special handling of DIRTY_MEMORY_M
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 17/62] kvm: remove special handling of DIRTY_MEMORY_MIGRATION in the dirty log mask |
Date: |
Fri, 5 Jun 2015 17:15:18 +0200 |
One recent example is commit 4cc856f (kvm-all: Sync dirty-bitmap from
kvm before kvm destroy the corresponding dirty_bitmap, 2015-04-02).
Another performance problem is that KVM keeps tracking dirty pages
after a failed live migration, which causes bad performance due to
disallowing huge page mapping.
Thanks to the previous patch, KVM can now stop hooking into
log_global_start/stop. This simplifies the KVM code noticeably.
Reported-by: Wanpeng Li <address@hidden>
Reported-by: Xiao Guangrong <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
kvm-all.c | 56 ++------------------------------------------------------
1 file changed, 2 insertions(+), 54 deletions(-)
diff --git a/kvm-all.c b/kvm-all.c
index 36e8109..53e01d4 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -83,7 +83,6 @@ struct KVMState
struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
bool coalesced_flush_in_progress;
int broken_set_mem_region;
- int migration_log;
int vcpu_events;
int robust_singlestep;
int debugregs;
@@ -234,9 +233,6 @@ static int kvm_set_user_memory_region(KVMState *s, KVMSlot
*slot)
mem.guest_phys_addr = slot->start_addr;
mem.userspace_addr = (unsigned long)slot->ram;
mem.flags = slot->flags;
- if (s->migration_log) {
- mem.flags |= KVM_MEM_LOG_DIRTY_PAGES;
- }
if (slot->memory_size && mem.flags & KVM_MEM_READONLY) {
/* Set the slot size to 0 before setting the slot to the desired
@@ -317,10 +313,6 @@ static int kvm_slot_dirty_pages_log_change(KVMSlot *mem,
bool log_dirty)
mem->flags = flags;
/* If nothing changed effectively, no need to issue ioctl */
- if (s->migration_log) {
- flags |= KVM_MEM_LOG_DIRTY_PAGES;
- }
-
if (flags == old_flags) {
return 0;
}
@@ -375,31 +367,6 @@ static void kvm_log_stop(MemoryListener *listener,
}
}
-static int kvm_set_migration_log(bool enable)
-{
- KVMState *s = kvm_state;
- KVMSlot *mem;
- int i, err;
-
- s->migration_log = enable;
-
- for (i = 0; i < s->nr_slots; i++) {
- mem = &s->slots[i];
-
- if (!mem->memory_size) {
- continue;
- }
- if (!!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES) == enable) {
- continue;
- }
- err = kvm_set_user_memory_region(s, mem);
- if (err) {
- return err;
- }
- }
- return 0;
-}
-
/* get kvm's dirty pages bitmap and update qemu's */
static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
unsigned long *bitmap)
@@ -671,8 +638,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section,
bool add)
KVMSlot *mem, old;
int err;
MemoryRegion *mr = section->mr;
- bool log_dirty =
- memory_region_get_dirty_log_mask(mr) & ~(1 << DIRTY_MEMORY_MIGRATION);
+ bool log_dirty = memory_region_get_dirty_log_mask(mr) != 0;
bool writeable = !mr->readonly && !mr->rom_device;
bool readonly_flag = mr->readonly || memory_region_is_romd(mr);
hwaddr start_addr = section->offset_within_address_space;
@@ -724,7 +690,7 @@ static void kvm_set_phys_mem(MemoryRegionSection *section,
bool add)
old = *mem;
- if ((mem->flags & KVM_MEM_LOG_DIRTY_PAGES) || s->migration_log) {
+ if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) {
kvm_physical_sync_dirty_bitmap(section);
}
@@ -853,22 +819,6 @@ static void kvm_log_sync(MemoryListener *listener,
}
}
-static void kvm_log_global_start(struct MemoryListener *listener)
-{
- int r;
-
- r = kvm_set_migration_log(1);
- assert(r >= 0);
-}
-
-static void kvm_log_global_stop(struct MemoryListener *listener)
-{
- int r;
-
- r = kvm_set_migration_log(0);
- assert(r >= 0);
-}
-
static void kvm_mem_ioeventfd_add(MemoryListener *listener,
MemoryRegionSection *section,
bool match_data, uint64_t data,
@@ -944,8 +894,6 @@ static MemoryListener kvm_memory_listener = {
.log_start = kvm_log_start,
.log_stop = kvm_log_stop,
.log_sync = kvm_log_sync,
- .log_global_start = kvm_log_global_start,
- .log_global_stop = kvm_log_global_stop,
.eventfd_add = kvm_mem_ioeventfd_add,
.eventfd_del = kvm_mem_ioeventfd_del,
.coalesced_mmio_add = kvm_coalesce_mmio_region,
--
2.4.1
- [Qemu-devel] [PULL 07/62] g364fb: remove pointless call to memory_region_set_coalescing, (continued)
- [Qemu-devel] [PULL 07/62] g364fb: remove pointless call to memory_region_set_coalescing, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 08/62] display: enable DIRTY_MEMORY_VGA tracking explicitly, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 09/62] display: add memory_region_sync_dirty_bitmap calls, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 10/62] memory: differentiate memory_region_is_logging and memory_region_get_dirty_log_mask, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 11/62] memory: prepare for multiple bits in the dirty log mask, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 12/62] framebuffer: check memory_region_is_logging, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 14/62] memory: track DIRTY_MEMORY_CODE in mr->dirty_log_mask, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 13/62] ui/console: remove dpy_gfx_update_dirty, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 15/62] kvm: accept non-mapped memory in kvm_dirty_pages_log_change, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 16/62] memory: include DIRTY_MEMORY_MIGRATION in the dirty log mask, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 17/62] kvm: remove special handling of DIRTY_MEMORY_MIGRATION in the dirty log mask,
Paolo Bonzini <=
- [Qemu-devel] [PULL 19/62] exec: use memory_region_get_dirty_log_mask to optimize dirty tracking, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 20/62] exec: move functions to translate-all.h, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 18/62] ram_addr: tweaks to xen_modified_memory, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 21/62] translate-all: remove unnecessary argument to tb_invalidate_phys_range, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 22/62] cputlb: remove useless arguments to tlb_unprotect_code_phys, rename, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 24/62] exec: pass client mask to cpu_physical_memory_set_dirty_range, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 23/62] translate-all: make less of tb_invalidate_phys_page_range depend on is_cpu_write_access, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 25/62] exec: invert return value of cpu_physical_memory_get_clean, rename, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 26/62] exec: only check relevant bitmaps for cleanliness, Paolo Bonzini, 2015/06/05
- [Qemu-devel] [PULL 27/62] memory: do not touch code dirty bitmap unless TCG is enabled, Paolo Bonzini, 2015/06/05