From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCnR9-0007Ma-HZ for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:13:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCnR0-0002SD-8f for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:13:43 -0400 Received: from e23smtp02.au.ibm.com ([202.81.31.144]:50849) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCnQz-0002RP-L1 for qemu-devel@nongnu.org; Fri, 23 Aug 2013 05:13:34 -0400 Received: from /spool/local by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Aug 2013 19:01:57 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 4AAB52CE8051 for ; Fri, 23 Aug 2013 19:13:11 +1000 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7N8v1HV65405092 for ; Fri, 23 Aug 2013 18:57:02 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r7N9D9WU008447 for ; Fri, 23 Aug 2013 19:13:10 +1000 Message-ID: <5217275C.3030104@linux.vnet.ibm.com> Date: Fri, 23 Aug 2013 17:11:56 +0800 From: Lei Li MIME-Version: 1.0 References: <1377069536-12658-1-git-send-email-lilei@linux.vnet.ibm.com> <1377069536-12658-5-git-send-email-lilei@linux.vnet.ibm.com> <52149998.7070004@redhat.com> <5216D488.2090305@linux.vnet.ibm.com> <1346435024.3140056.1377236057706.JavaMail.root@redhat.com> In-Reply-To: <1346435024.3140056.1377236057706.JavaMail.root@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 04/18] savevm: set right return value for qemu_file_rate_limit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aarcange@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, Anthony Liguori , lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com On 08/23/2013 01:34 PM, Paolo Bonzini wrote: >> Say, In ram_save_iterate(), the current logic is: >> >> ret = qemu_file_rate_limit(); >> while(ret == 0) { >> save RAM blocks until no more to send. >> } >> if (ret < 0) { >> return ret; >> } >> ... >> >> And in savevm layer, qemu_savevm_state_iterate() set an error if the return >> value of ram_save_iterate < 0. > But that is to report errors *not in the QEMUFile*. Errors in the > QEMUFile are already reported by qemu_file_get_error(), and > qemu_savevm_state_iterate() will not overwrite them. Sorry, a little confusion. In qemu_savevm_state_iterate(), if the return of ram_save_iterate < 0, it will set error in QEMUFile by qemu_file_set_error(f, ret), the error reported by qemu_file_get_error() in the QEMUFile is got from qemu_file_set_error() by reading the f->last_error, right? And now as qemu_file_rate_limit() never return negative value, what's the meaning for the check: if (qemu_file_rate_limit(f) < 0) in ram_save_iterate()? > > qemu_file_rate_limit() returning 1 is enough to exit the loop, > which is all that is needed. >> Obviously the return value of qemu_file_rate_limit() should have an negative >> value for there has been an error. Otherwise we need to modify the logic >> above. > It is not obvious to me... what is, again, the bug that you're observing? > I think it is happening only because you're modifying the migration thread's > body. If you use the normal code of the migration thread, it will just work. > > Paolo > -- Lei