From b0a46a333acfd78da56cf6aebb95f4a5dfb3a4f2 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Sat, 2 May 2009 00:22:51 +0200 Subject: kvm: Add missing bits to support live migration This patch adds the missing hooks to allow live migration in KVM mode. It adds proper synchronization before/after saving/restoring the VCPU states (note: PPC is untested), hooks into cpu_physical_memory_set_dirty_tracking() to enable dirty memory logging at KVM level, and synchronizes that drity log into QEMU's view before running ram_live_save(). Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori --- exec.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'exec.c') diff --git a/exec.c b/exec.c index 544fb43074..723de89bf4 100644 --- a/exec.c +++ b/exec.c @@ -516,6 +516,8 @@ static void cpu_common_save(QEMUFile *f, void *opaque) { CPUState *env = opaque; + cpu_synchronize_state(env, 0); + qemu_put_be32s(f, &env->halted); qemu_put_be32s(f, &env->interrupt_request); } @@ -533,6 +535,7 @@ static int cpu_common_load(QEMUFile *f, void *opaque, int version_id) version_id is increased. */ env->interrupt_request &= ~0x01; tlb_flush(env, 1); + cpu_synchronize_state(env, 1); return 0; } @@ -1923,6 +1926,9 @@ void cpu_physical_memory_reset_dirty(ram_addr_t start, ram_addr_t end, int cpu_physical_memory_set_dirty_tracking(int enable) { in_migration = enable; + if (kvm_enabled()) { + return kvm_set_migration_log(enable); + } return 0; } -- cgit 1.4.1