From: Marcelo Tosatti <mtosatti@redhat.com>
To: Andrey Korolyov <andrey@xdel.ru>
Cc: Amit Shah <amit.shah@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] latest rc: virtio-blk hangs forever after migration
Date: Wed, 16 Jul 2014 08:52:29 -0300 [thread overview]
Message-ID: <20140716115229.GA7741@amt.cnet> (raw)
In-Reply-To: <CABYiri96UbyO238wYKz9OC5Tn69jZ7XdaoEX1A2ucbPTrbA1tg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6252 bytes --]
On Wed, Jul 16, 2014 at 12:38:51PM +0400, Andrey Korolyov wrote:
> On Wed, Jul 16, 2014 at 5:16 AM, Marcelo Tosatti <mtosatti@redhat.com> wrote:
> > On Wed, Jul 16, 2014 at 03:40:47AM +0400, Andrey Korolyov wrote:
> >> On Wed, Jul 16, 2014 at 2:01 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> > Il 15/07/2014 23:25, Andrey Korolyov ha scritto:
> >> >
> >> >> On Wed, Jul 16, 2014 at 1:09 AM, Marcelo Tosatti <mtosatti@redhat.com>
> >> >> wrote:
> >> >>>
> >> >>> On Tue, Jul 15, 2014 at 06:01:08PM +0400, Andrey Korolyov wrote:
> >> >>>>
> >> >>>> On Tue, Jul 15, 2014 at 10:52 AM, Andrey Korolyov <andrey@xdel.ru>
> >> >>>> wrote:
> >> >>>>>
> >> >>>>> On Tue, Jul 15, 2014 at 9:03 AM, Amit Shah <amit.shah@redhat.com>
> >> >>>>> wrote:
> >> >>>>>>
> >> >>>>>> 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.
> >> >>>>
> >> >>>>
> >> >>>> Yay! It is even outside of virtio-blk.
> >> >>>>
> >> >>>> commit 9b1786829aefb83f37a8f3135e3ea91c56001b56
> >> >>>> Author: Marcelo Tosatti <mtosatti@redhat.com>
> >> >>>> Date: Tue Jun 3 13:34:48 2014 -0300
> >> >>>>
> >> >>>> kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec
> >> >>>> calculation
> >> >>>>
> >> >>>> Ensure proper env->tsc value for kvmclock_current_nsec calculation.
> >> >>>>
> >> >>>> Reported-by: Marcin Gibuła <m.gibula@beyond.pl>
> >> >>>> Cc: qemu-stable@nongnu.org
> >> >>>> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> >> >>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> >>>
> >> >>>
> >> >>> Andrey,
> >> >>>
> >> >>> Can you please provide instructions on how to create reproducible
> >> >>> environment?
> >> >>>
> >> >>> 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"
> >> >>>
> >> >>> @@ -66,7 +65,6 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s)
> >> >>>
> >> >>> cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time));
> >> >>>
> >> >>> - assert(time.tsc_timestamp <= migration_tsc);
> >> >>> delta = migration_tsc - time.tsc_timestamp;
> >> >>> if (time.tsc_shift < 0) {
> >> >>> delta >>= -time.tsc_shift;
> >> >>> @@ -125,8 +123,6 @@ static void kvmclock_vm_state_change(void *opaque,
> >> >>> int running,
> >> >>> if (s->clock_valid) {
> >> >>> return;
> >> >>> }
> >> >>> -
> >> >>> - cpu_synchronize_all_states();
> >> >>> ret = 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 = runstate_is_running();
> >> >>>
> >> >>> + cpu_synchronize_all_states();
> >> >>> ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
> >> >>> if (ret >= 0) {
> >> >>> qemu_file_set_rate_limit(s->file, INT64_MAX);
> >> >
> >> >
> >> > It could also be useful to apply the above patch _and_ revert
> >> > a096b3a6732f846ec57dc28b47ee9435aa0609bf, then try to reproduce.
> >> >
> >> > Paolo
> >>
> >> Yes, it solved the issue for me! (it took much time to check because
> >> most of country` debian mirrors went inconsistent by some reason)
> >>
> >> Also trivial addition:
> >>
> >> diff --git a/migration.c b/migration.c
> >> index 34f2325..65d1c88 100644
> >> --- a/migration.c
> >> +++ b/migration.c
> >> @@ -25,6 +25,7 @@
> >> #include "qemu/thread.h"
> >> #include "qmp-commands.h"
> >> #include "trace.h"
> >> +#include "sysemu/cpus.h"
> >
> > And what about not reverting a096b3a6732f846ec57dc28b47ee9435aa0609bf ?
> >
> > That is, test with a stock qemu.git tree and the patch sent today,
> > on this thread, to move cpu_synchronize_all_states ?
> >
> >
>
> The main reason for things to work for me is a revert of
> 9b1786829aefb83f37a8f3135e3ea91c56001b56 on top, not adding any other
> patches. I had tested two cases, with Alexander`s patch completely
> reverted plus suggestion from Marcelo and only with revert 9b178682
> plug same suggestion. The difference is that the until Alexander`
> patch is not reverted, live migration is always failing by the timeout
> value, and when reverted migration always succeeds in 8-10 seconds.
> Appropriate diffs are attached for the reference.
Andrey,
Can you please apply only the following attached patch to an upstream
QEMU git tree (move_synchronize_all_states.patch), plus the necessary
header file corrections, and attempt to reproduce?
When you reproduce, please provide a backtrace and version of the QEMU
git tree, and instructions on how to reproduce:
1) full QEMU command line
2) steps to reproduce
[-- Attachment #2: move_synchronize_all_states.patch --]
[-- Type: text/plain, Size: 1549 bytes --]
Move cpu_synchronize_all_states to migration.c.
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"
@@ -66,7 +65,6 @@ static uint64_t kvmclock_current_nsec(KVMClockState *s)
cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time));
- assert(time.tsc_timestamp <= migration_tsc);
delta = migration_tsc - time.tsc_timestamp;
if (time.tsc_shift < 0) {
delta >>= -time.tsc_shift;
@@ -125,8 +123,6 @@ static void kvmclock_vm_state_change(void *opaque, int running,
if (s->clock_valid) {
return;
}
-
- cpu_synchronize_all_states();
ret = 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 = runstate_is_running();
+ cpu_synchronize_all_states();
ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
if (ret >= 0) {
qemu_file_set_rate_limit(s->file, INT64_MAX);
next prev parent reply other threads:[~2014-07-16 11:52 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-13 12:28 [Qemu-devel] latest rc: virtio-blk hangs forever after migration Andrey Korolyov
2014-07-13 15:29 ` Andrey Korolyov
2014-07-15 15:57 ` Paolo Bonzini
2014-07-15 17:32 ` Andrey Korolyov
2014-07-15 17:39 ` Andrey Korolyov
2014-07-15 5:03 ` Amit Shah
2014-07-15 6:52 ` Andrey Korolyov
2014-07-15 14:01 ` Andrey Korolyov
2014-07-15 21:09 ` Marcelo Tosatti
2014-07-15 21:25 ` Andrey Korolyov
2014-07-15 22:01 ` Paolo Bonzini
2014-07-15 23:40 ` Andrey Korolyov
2014-07-15 23:47 ` Marcelo Tosatti
2014-07-16 1:16 ` Marcelo Tosatti
2014-07-16 8:38 ` Andrey Korolyov
2014-07-16 11:52 ` Marcelo Tosatti [this message]
2014-07-16 13:24 ` Andrey Korolyov
2014-07-16 18:25 ` Andrey Korolyov
2014-07-16 21:28 ` Marcin Gibuła
2014-07-16 21:36 ` Andrey Korolyov
2014-07-17 9:49 ` Marcin Gibuła
2014-07-17 11:20 ` Marcin Gibuła
2014-07-17 11:54 ` Marcin Gibuła
2014-07-17 12:06 ` Andrey Korolyov
2014-07-17 13:25 ` Marcin Gibuła
2014-07-17 19:18 ` Dr. David Alan Gilbert
2014-07-17 20:33 ` Marcin Gibuła
2014-07-17 20:50 ` Andrey Korolyov
2014-07-18 8:21 ` Marcin Gibuła
2014-07-18 8:36 ` Andrey Korolyov
2014-07-18 8:44 ` Marcin Gibuła
2014-07-18 8:51 ` Paolo Bonzini
2014-07-18 8:48 ` Paolo Bonzini
2014-07-18 8:57 ` Amit Shah
2014-07-18 9:32 ` Marcin Gibuła
2014-07-18 9:37 ` Paolo Bonzini
2014-07-18 9:48 ` Marcin Gibuła
2014-07-29 16:58 ` Paolo Bonzini
2014-07-30 12:02 ` Marcin Gibuła
2014-07-30 13:38 ` Paolo Bonzini
2014-07-30 22:12 ` Marcin Gibuła
2014-07-31 11:27 ` Marcin Gibuła
2014-08-04 16:30 ` Marcin Gibuła
2014-08-04 18:30 ` Paolo Bonzini
2014-08-08 21:37 ` Marcelo Tosatti
2014-08-09 6:35 ` Paolo Bonzini
2014-08-21 15:48 ` Andrey Korolyov
2014-08-21 16:41 ` Andrey Korolyov
2014-08-21 16:44 ` Paolo Bonzini
2014-08-21 17:51 ` Andrey Korolyov
2014-08-22 16:44 ` Andrey Korolyov
2014-08-22 17:45 ` Marcelo Tosatti
2014-08-22 18:39 ` Andrey Korolyov
2014-08-22 19:05 ` Marcelo Tosatti
2014-08-22 19:05 ` Marcelo Tosatti
2014-08-22 19:51 ` Andrey Korolyov
2014-08-22 21:01 ` Marcelo Tosatti
2014-08-22 22:21 ` Andrey Korolyov
2014-08-24 16:19 ` Andrey Korolyov
2014-08-24 16:35 ` Paolo Bonzini
2014-08-24 16:57 ` Andrey Korolyov
2014-08-24 18:51 ` Andrey Korolyov
2014-08-24 20:14 ` Andrey Korolyov
2014-08-25 10:45 ` Paolo Bonzini
2014-08-25 10:51 ` Andrey Korolyov
2014-09-04 16:38 ` Marcelo Tosatti
2014-09-04 16:52 ` Andrey Korolyov
2014-09-04 18:54 ` Marcelo Tosatti
2014-09-04 18:54 ` Marcelo Tosatti
2014-09-04 19:13 ` Andrey Korolyov
2014-08-22 17:55 ` Paolo Bonzini
2014-10-09 19:07 ` Eduardo Habkost
2014-10-10 7:33 ` Marcin Gibuła
2014-10-11 12:58 ` Eduardo Habkost
2014-07-16 7:35 ` Marcin Gibuła
2014-07-16 12:00 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140716115229.GA7741@amt.cnet \
--to=mtosatti@redhat.com \
--cc=amit.shah@redhat.com \
--cc=andrey@xdel.ru \
--cc=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).