From: "Marcin Gibuła" <m.gibula@beyond.pl>
To: Andrey Korolyov <andrey@xdel.ru>
Cc: Amit Shah <amit.shah@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcelo Tosatti <mtosatti@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: Thu, 17 Jul 2014 15:25:57 +0200 [thread overview]
Message-ID: <53C7CEE5.4080006@beyond.pl> (raw)
In-Reply-To: <CABYiri-aeP=0NcKaoaa=_au9sruvxnPVNri_Vy2KxKFHRj2fUw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1044 bytes --]
>> 2.1-rc2 behaves exactly the same.
>>
>> Interestingly enough, reseting guest system causes I/O to work again. So
>> it's not qemu that hangs on IO, rather it fails to notify guest about
>> completed operations that were issued during migration.
>>
>> And its somehow caused by calling cpu_synchronize_all_states() inside
>> kvmclock_vm_state_change().
>>
>>
>>
>> As for testing with cache=writeback, I'll try to setup some iscsi to test
>> it.
>
> Awesome, thanks! AFAIK you`ll not be able to use write cache with
> iscsi for migration. VM which had a reset before hangs always when
> freshly launched have a chance to be migrated successfully. And yes,
> it looks like lower layer forgetting to notify driver about some
> operations at a glance.
Andrey,
could you try attached patch? It's an incredibly ugly workaround that
calls cpu_synchronize_all_states() in a way that bypasses lazy execution
logic.
But it works for me. If that works for you as well, its somehow related
to lazy execution of cpu_synchronize_all_states.
--
mg
[-- Attachment #2: io-hang.patch --]
[-- Type: text/x-patch, Size: 3151 bytes --]
diff -ru qemu-2.1.0-rc2/cpus.c qemu-2.1.0-rc2-fixed/cpus.c
--- qemu-2.1.0-rc2/cpus.c 2014-07-15 23:49:14.000000000 +0200
+++ qemu-2.1.0-rc2-fixed/cpus.c 2014-07-17 15:09:09.306696284 +0200
@@ -505,6 +505,15 @@
}
}
+void cpu_synchronize_all_states_always(void)
+{
+ CPUState *cpu;
+
+ CPU_FOREACH(cpu) {
+ cpu_synchronize_state_always(cpu);
+ }
+}
+
void cpu_synchronize_all_post_reset(void)
{
CPUState *cpu;
diff -ru qemu-2.1.0-rc2/hw/i386/kvm/clock.c qemu-2.1.0-rc2-fixed/hw/i386/kvm/clock.c
--- qemu-2.1.0-rc2/hw/i386/kvm/clock.c 2014-07-15 23:49:14.000000000 +0200
+++ qemu-2.1.0-rc2-fixed/hw/i386/kvm/clock.c 2014-07-17 15:08:25.627063756 +0200
@@ -126,7 +126,7 @@
return;
}
- cpu_synchronize_all_states();
+ cpu_synchronize_all_states_always();
ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data);
if (ret < 0) {
fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret));
diff -ru qemu-2.1.0-rc2/include/sysemu/cpus.h qemu-2.1.0-rc2-fixed/include/sysemu/cpus.h
--- qemu-2.1.0-rc2/include/sysemu/cpus.h 2014-07-15 23:49:14.000000000 +0200
+++ qemu-2.1.0-rc2-fixed/include/sysemu/cpus.h 2014-07-17 15:09:23.256578916 +0200
@@ -7,6 +7,7 @@
void pause_all_vcpus(void);
void cpu_stop_current(void);
+void cpu_synchronize_all_states_always(void);
void cpu_synchronize_all_states(void);
void cpu_synchronize_all_post_reset(void);
void cpu_synchronize_all_post_init(void);
diff -ru qemu-2.1.0-rc2/include/sysemu/kvm.h qemu-2.1.0-rc2-fixed/include/sysemu/kvm.h
--- qemu-2.1.0-rc2/include/sysemu/kvm.h 2014-07-15 23:49:14.000000000 +0200
+++ qemu-2.1.0-rc2-fixed/include/sysemu/kvm.h 2014-07-17 15:11:54.855303171 +0200
@@ -346,9 +346,11 @@
#endif /* NEED_CPU_H */
void kvm_cpu_synchronize_state(CPUState *cpu);
+void kvm_cpu_synchronize_state_always(CPUState *cpu);
void kvm_cpu_synchronize_post_reset(CPUState *cpu);
void kvm_cpu_synchronize_post_init(CPUState *cpu);
+
/* generic hooks - to be moved/refactored once there are more users */
static inline void cpu_synchronize_state(CPUState *cpu)
@@ -358,6 +360,13 @@
}
}
+static inline void cpu_synchronize_state_always(CPUState *cpu)
+{
+ if (kvm_enabled()) {
+ kvm_cpu_synchronize_state_always(cpu);
+ }
+}
+
static inline void cpu_synchronize_post_reset(CPUState *cpu)
{
if (kvm_enabled()) {
diff -ru qemu-2.1.0-rc2/kvm-all.c qemu-2.1.0-rc2-fixed/kvm-all.c
--- qemu-2.1.0-rc2/kvm-all.c 2014-07-15 23:49:14.000000000 +0200
+++ qemu-2.1.0-rc2-fixed/kvm-all.c 2014-07-17 15:14:04.884208826 +0200
@@ -1652,6 +1652,13 @@
s->coalesced_flush_in_progress = false;
}
+static void do_kvm_cpu_synchronize_state_always(void *arg)
+{
+ CPUState *cpu = arg;
+
+ kvm_arch_get_registers(cpu);
+}
+
static void do_kvm_cpu_synchronize_state(void *arg)
{
CPUState *cpu = arg;
@@ -1669,6 +1676,11 @@
}
}
+void kvm_cpu_synchronize_state_always(CPUState *cpu)
+{
+ run_on_cpu(cpu, do_kvm_cpu_synchronize_state_always, cpu);
+}
+
void kvm_cpu_synchronize_post_reset(CPUState *cpu)
{
kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE);
next prev parent reply other threads:[~2014-07-17 13:26 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
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 [this message]
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=53C7CEE5.4080006@beyond.pl \
--to=m.gibula@beyond.pl \
--cc=amit.shah@redhat.com \
--cc=andrey@xdel.ru \
--cc=famz@redhat.com \
--cc=mtosatti@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).