From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X79zH-0005Pk-R7 for qemu-devel@nongnu.org; Tue, 15 Jul 2014 17:10:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X79zC-0006zV-GX for qemu-devel@nongnu.org; Tue, 15 Jul 2014 17:10:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X79zC-0006xO-9R for qemu-devel@nongnu.org; Tue, 15 Jul 2014 17:10:06 -0400 Date: Tue, 15 Jul 2014 18:09:48 -0300 From: Marcelo Tosatti Message-ID: <20140715210948.GA20036@amt.cnet> References: <20140715050318.GD26186@grmbl.mre> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] latest rc: virtio-blk hangs forever after migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrey Korolyov Cc: Amit Shah , Paolo Bonzini , Fam Zheng , "qemu-devel@nongnu.org" On Tue, Jul 15, 2014 at 06:01:08PM +0400, Andrey Korolyov wrote: > On Tue, Jul 15, 2014 at 10:52 AM, Andrey Korolyov wrot= e: > > On Tue, Jul 15, 2014 at 9:03 AM, Amit Shah wro= te: > >> On (Sun) 13 Jul 2014 [16:28:56], Andrey Korolyov wrote: > >>> Hello, > >>> > >>> the issue is not specific to the iothread code because generic > >>> virtio-blk also hangs up: > >> > >> Do you know which version works well? If you could bisect, that'll > >> help a lot. > >> > >> Thanks, > >> Amit > > > > Hi, > > > > 2.0 works definitely well. I`ll try to finish bisection today, though > > every step takes about 10 minutes to complete. >=20 > Yay! It is even outside of virtio-blk. >=20 > commit 9b1786829aefb83f37a8f3135e3ea91c56001b56 > Author: Marcelo Tosatti > Date: Tue Jun 3 13:34:48 2014 -0300 >=20 > kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec ca= lculation >=20 > Ensure proper env->tsc value for kvmclock_current_nsec calculation. >=20 > Reported-by: Marcin Gibu=C5=82a > Cc: qemu-stable@nongnu.org > Signed-off-by: Marcelo Tosatti > Signed-off-by: Paolo Bonzini Andrey, Can you please provide instructions on how to create reproducible=20 environment?=20 The following patch is equivalent to the original patch, for the purposes of fixing the kvmclock problem. Perhaps it becomes easier to spot the reason for the hang you are experiencing. diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index 272a88a..feb5fc5 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -17,7 +17,6 @@ #include "qemu/host-utils.h" #include "sysemu/sysemu.h" #include "sysemu/kvm.h" -#include "sysemu/cpus.h" #include "hw/sysbus.h" #include "hw/kvm/clock.h" =20 @@ -66,7 +65,6 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s) =20 cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time)); =20 - assert(time.tsc_timestamp <=3D migration_tsc); delta =3D migration_tsc - time.tsc_timestamp; if (time.tsc_shift < 0) { delta >>=3D -time.tsc_shift; @@ -125,8 +123,6 @@ static void kvmclock_vm_state_change(void *opaque, in= t running, if (s->clock_valid) { return; } - - cpu_synchronize_all_states(); ret =3D kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data); if (ret < 0) { fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret))= ; diff --git a/migration.c b/migration.c index 8d675b3..34f2325 100644 --- a/migration.c +++ b/migration.c @@ -608,6 +608,7 @@ static void *migration_thread(void *opaque) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); old_vm_running =3D runstate_is_running(); =20 + cpu_synchronize_all_states(); ret =3D vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); if (ret >=3D 0) { qemu_file_set_rate_limit(s->file, INT64_MAX);