From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxoB-0000rM-54 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:24:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMxo4-00010M-W2 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:24:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMxo4-00010I-M6 for qemu-devel@nongnu.org; Thu, 28 Aug 2014 07:23:56 -0400 Message-ID: <53FF1132.5070608@redhat.com> Date: Thu, 28 Aug 2014 13:23:30 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1404495717-4239-1-git-send-email-dgilbert@redhat.com> <1404495717-4239-32-git-send-email-dgilbert@redhat.com> <53B7D118.50008@redhat.com> <20140828110448.GB2402@work-vm> In-Reply-To: <20140828110448.GB2402@work-vm> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 31/46] Postcopy: Rework migration thread for postcopy mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert" Cc: aarcange@redhat.com, yamahata@private.email.ne.jp, quintela@redhat.com, qemu-devel@nongnu.org, lilei@linux.vnet.ibm.com Il 28/08/2014 13:04, Dr. David Alan Gilbert ha scritto: >> You don't really need the "else" if you have a continue. However, do you >> need _any_ of the "else" and "continue"? Would the next iteration of the >> "while" loop do anything else but invoking qemu_savevm_state_iterate. > > Yes, I've dropped that 'else'; however, I've kept the continue - we're about > 3 if's deep here inside the loop and there's a bunch of stuff at the end of > the if's but still inside the loop that I'm not 100% sure I want to run > again at this point (although it's probably OK). My point is that the next iteration would start exactly with the else (calling qemu_savevm_state_iterate) and then do the stuff at the end of the if's (bandwidth calculation and all that). So why not do that immediately, without the "continue"? > A lot of this stuff is done, but it's done at the point we transition into > postcopy, not at the end (see postcopy_start). Perhaps you can move the common parts to a separate function instead of cut-and-paste? ;) > However, I've not > got the wakup_request and old_vm_running check; so I probably need to > think where they should go; what's the purpose of the qemu_system_wakeup_request > there ? it seems to be getting the guest into running state - which is > where I'd assumed it was already. No, it doesn't have to---you could be doing non-live migration. old_vm_running makes sure that if migration fails the VM restarts. You need to grab the state just before force-stopping the VM. Regarding qemu_system_wakeup_request, it only does something if the virtual machine is suspended-to-RAM; the call should be handling migration of such a VM. The idea is that since we don't transmit the runstate, we just wakeup the VM on the destination. But you need to prepare the VM for that (which is basically a reset plus setting a couple of ACPI registers). The handling of the request is done here: if (qemu_wakeup_requested()) { pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); notifier_list_notify(&wakeup_notifiers, &wakeup_reason); wakeup_reason = QEMU_WAKEUP_REASON_NONE; resume_all_vcpus(); qapi_event_send_wakeup(&error_abort); } However, it might be broken or might be working by chance only. Paolo