From patchwork Fri Jan 21 20:48:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [15/18] kvm: Flush coalesced mmio buffer on IO window exits Date: Fri, 21 Jan 2011 10:48:19 -0000 From: Jan Kiszka X-Patchwork-Id: 79940 Message-Id: To: Avi Kivity , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org From: Jan Kiszka We must flush pending mmio writes if we leave kvm_cpu_exec for an IO window. Otherwise we risk to loose those requests when migrating to a different host during that window. Signed-off-by: Jan Kiszka --- kvm-all.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 3a1f63b..9976762 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -918,6 +918,8 @@ int kvm_cpu_exec(CPUState *env) cpu_single_env = env; kvm_arch_post_run(env, run); + kvm_flush_coalesced_mmio_buffer(); + if (ret == -EINTR || ret == -EAGAIN) { cpu_exit(env); DPRINTF("io window exit\n"); @@ -930,8 +932,6 @@ int kvm_cpu_exec(CPUState *env) abort(); } - kvm_flush_coalesced_mmio_buffer(); - ret = 0; /* exit loop */ switch (run->exit_reason) { case KVM_EXIT_IO: