From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCk11-00007R-EM for qemu-devel@nongnu.org; Fri, 23 Aug 2013 01:34:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCk0v-0007Wu-Fu for qemu-devel@nongnu.org; Fri, 23 Aug 2013 01:34:31 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:58062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCk0v-0007Wi-8g for qemu-devel@nongnu.org; Fri, 23 Aug 2013 01:34:25 -0400 Date: Fri, 23 Aug 2013 01:34:17 -0400 (EDT) From: Paolo Bonzini Message-ID: <1346435024.3140056.1377236057706.JavaMail.root@redhat.com> In-Reply-To: <5216D488.2090305@linux.vnet.ibm.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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: Lei Li Cc: aarcange@redhat.com, aliguori@us.ibm.com, quintela@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, lagarcia@br.ibm.com, rcj@linux.vnet.ibm.com > 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. 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