From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: [PATCH 18/17] kvm: Flush coalesced mmio buffer on IO window exits Date: Mon, 03 Jan 2011 13:44:11 +0100 Message-ID: <4D21C49B.6080403@web.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org To: Avi Kivity , Marcelo Tosatti Return-path: Received: from fmmailgate03.web.de ([217.72.192.234]:57526 "EHLO fmmailgate03.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754306Ab1ACMoN (ORCPT ); Mon, 3 Jan 2011 07:44:13 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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 15d5f32..766a3a7 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -844,6 +844,8 @@ void 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"); @@ -856,8 +858,6 @@ void kvm_cpu_exec(CPUState *env) abort(); } - kvm_flush_coalesced_mmio_buffer(); - ret = 0; /* exit loop */ switch (run->exit_reason) { case KVM_EXIT_IO: