From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFlll-0002xd-MQ for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:35:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFllg-0007ps-DS for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:35:33 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:27566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFllf-0007p7-IT for qemu-devel@nongnu.org; Tue, 18 Feb 2014 09:35:27 -0500 Message-ID: <53036F8D.1060503@inria.fr> Date: Tue, 18 Feb 2014 15:34:53 +0100 From: Vincent KHERBACHE MIME-Version: 1.0 References: <1392726818-14606-1-git-send-email-vincent.kherbache@inria.fr> <53035EB8.4050206@redhat.com> In-Reply-To: <53035EB8.4050206@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] kvm: fix kvm_set_migration_log() behavior List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Paolo Bonzini , gleb@redhat.com Le 18/02/2014 14:23, Eric Blake a écrit : >> - return err; >> - } >> + err = kvm_slot_dirty_pages_log_change(mem, (bool)enable); > > Is this a v2 post? Any reason you reposted without addressing my > earlier review? > https://lists.gnu.org/archive/html/qemu-devel/2014-02/msg02840.html My bad, I apologize for the duplicate post I just missed your review. >> + err = kvm_slot_dirty_pages_log_change(mem, (bool)enable); > > Casting to bool looks odd. We already require a compliant C99 compiler, > which means the compiler already properly handles the squashing of all > non-zero values to true when calling a function with a parameter > prototyped as bool, without needing the cast. Thanks for information, here is the patch without the useless casting. BR. 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..007df56 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, enable); } - return 0; + return err; } /* get kvm's dirty pages bitmap and update qemu's */ --- Vincent KHERBACHE