From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDt1a-0000nN-D0 for qemu-devel@nongnu.org; Mon, 26 Aug 2013 05:23:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VDt1R-0001NM-AR for qemu-devel@nongnu.org; Mon, 26 Aug 2013 05:23:50 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:59591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VDt1Q-0001LL-O9 for qemu-devel@nongnu.org; Mon, 26 Aug 2013 05:23:41 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 26 Aug 2013 14:42:20 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 7FA88394004D for ; Mon, 26 Aug 2013 14:53:22 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7Q9NSRC15335672 for ; Mon, 26 Aug 2013 14:53:28 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7Q9NU4j025259 for ; Mon, 26 Aug 2013 14:53:31 +0530 Message-ID: <521B1E48.6090306@linux.vnet.ibm.com> Date: Mon, 26 Aug 2013 17:22:16 +0800 From: Lei Li MIME-Version: 1.0 References: <1377264653-31031-1-git-send-email-lilei@linux.vnet.ibm.com> <1377264653-31031-3-git-send-email-lilei@linux.vnet.ibm.com> <521B115D.4040009@redhat.com> In-Reply-To: <521B115D.4040009@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH resend 3/3] arch_init: right return for ram_save_iterate List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: anthony@codemonkey.ws, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com On 08/26/2013 04:27 PM, Paolo Bonzini wrote: > Il 23/08/2013 15:30, Lei Li ha scritto: >> - if (ret < 0) { >> - bytes_transferred += total_sent; >> - return ret; >> - } >> - >> qemu_put_be64(f, RAM_SAVE_FLAG_EOS); >> total_sent += 8; >> bytes_transferred += total_sent; >> >> - return total_sent; >> + return qemu_file_get_error(f); > No, this will never make ram_save_iterate (and thus > qemu_savevm_state_iterate) return a positive, non-zero value. Thus: > > ret = qemu_file_get_error(f); > if (ret < 0) { > return ret; > } > return total_sent; > > If you look at the code, you can see that it never returns zero. > Probably it should do something like > > bytes_transferred += total_sent; > > /* Do not count these 8 bytes into total_sent, so that we can > * return 0 if no page had been dirtied. > */ > qemu_put_be64(f, RAM_SAVE_FLAG_EOS); > bytes_transferred += 8; > > and then proceed as above with "ret = qemu_file_get_error(f)". Yes, you are right. > > Paolo > -- Lei