[PATCH 18/17] kvm: Flush coalesced mmio buffer on IO window exits

Jan Kiszka
2011-01-03T12:44:13Z

From: Jan Kiszka <jan.kiszka@siemens.com>

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 <jan.kiszka@siemens.com>
---
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) {