From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFjsN-0003Dc-G5 for qemu-devel@nongnu.org; Tue, 18 Feb 2014 07:34:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFjsH-00031D-VB for qemu-devel@nongnu.org; Tue, 18 Feb 2014 07:34:15 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:42376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFjsH-000315-Ou for qemu-devel@nongnu.org; Tue, 18 Feb 2014 07:34:09 -0500 From: Vincent KHERBACHE Date: Tue, 18 Feb 2014 13:33:38 +0100 Message-Id: <1392726818-14606-1-git-send-email-vincent.kherbache@inria.fr> Subject: [Qemu-devel] [PATCH] kvm: fix kvm_set_migration_log() behavior List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, gleb@redhat.com The test (!!(mem->flags & KVM_MEM_LOG_DIRTY_PAGES) == enable) is wrong because the condition is valid when enable = 0 and current dirty log memory flag is set. As a consequence kvm_log_global_stop() does not stop the KVM dirty log tracking: kvm_set_migration_log(0) didn't do its job. So instead I propose to use kvm_slot_dirty_pages_log_change() which correctly compare the memory flags (old/new). Signed-off-by: Vincent KHERBACHE --- kvm-all.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 2ca9143..f104f87 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -355,7 +355,7 @@ static int kvm_set_migration_log(int enable) { KVMState *s = kvm_state; KVMSlot *mem; - int i, err; + int i, err = 0; s->migration_log = enable; @@ -365,15 +365,9 @@ static int kvm_set_migration_log(int enable) 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; - } + err = kvm_slot_dirty_pages_log_change(mem, (bool)enable); } - return 0; + return err; } /* get kvm's dirty pages bitmap and update qemu's */ -- 1.8.3.1