From: Sasha Levin Subject: [PATCH 2/2] kvm tools: Fix MMIO ordering problem cause due to coalescing Date: Wed, 14 Dec 2011 15:11:22 +0200 Message-ID: <1323868282-21747-2-git-send-email-levinsasha928@gmail.com> References: <1323868282-21747-1-git-send-email-levinsasha928@gmail.com> Cc: mingo@elte.hu, gorcunov@gmail.com, asias.hejun@gmail.com, kvm@vger.kernel.org, matt@ozlabs.org, Sasha Levin To: penberg@kernel.org Return-path: Received: from mail-ww0-f44.google.com ([74.125.82.44]:41390 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757156Ab1LNNLc (ORCPT ); Wed, 14 Dec 2011 08:11:32 -0500 Received: by wgbdr13 with SMTP id dr13so1796685wgb.1 for ; Wed, 14 Dec 2011 05:11:31 -0800 (PST) In-Reply-To: <1323868282-21747-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: If we took a MMIO exit, the data in the coalesced ring should be processes before the data in the exit itself is processed. Doing it wrong (like we did so far) will cause ordering issues. Signed-off-by: Sasha Levin --- tools/kvm/kvm-cpu.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c index b7ae3d3..a0f330f 100644 --- a/tools/kvm/kvm-cpu.c +++ b/tools/kvm/kvm-cpu.c @@ -126,6 +126,12 @@ int kvm_cpu__start(struct kvm_cpu *cpu) case KVM_EXIT_MMIO: { bool ret; + /* + * If we had MMIO exit, coalesced ring should be processed + * *before* processing the exit itself + */ + kvm_cpu__handle_coalesced_mmio(cpu); + ret = kvm_cpu__emulate_mmio(cpu->kvm, cpu->kvm_run->mmio.phys_addr, cpu->kvm_run->mmio.data, -- 1.7.8