From patchwork Mon Jan 24 09:02:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 80108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C0BAFB7120 for ; Mon, 24 Jan 2011 20:23:52 +1100 (EST) Received: from localhost ([127.0.0.1]:51165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhIeK-0006cW-KO for incoming@patchwork.ozlabs.org; Mon, 24 Jan 2011 04:23:48 -0500 Received: from [140.186.70.92] (port=37950 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PhIMQ-0008J0-Ke for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PhIMO-0007DX-34 for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50065) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PhIMN-0007Cl-SP for qemu-devel@nongnu.org; Mon, 24 Jan 2011 04:05:16 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95Few001140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 Jan 2011 04:05:15 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95EtB014208; Mon, 24 Jan 2011 04:05:15 -0500 Received: from amt.cnet (vpn2-9-29.ams2.redhat.com [10.36.9.29]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p0O95BU2008803; Mon, 24 Jan 2011 04:05:14 -0500 Received: from amt.cnet (localhost.localdomain [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id EE02A65215F; Mon, 24 Jan 2011 07:04:44 -0200 (BRST) Received: (from marcelo@localhost) by amt.cnet (8.14.4/8.14.4/Submit) id p0O94ft8028424; Mon, 24 Jan 2011 07:04:41 -0200 From: Marcelo Tosatti To: Anthony Liguori Date: Mon, 24 Jan 2011 07:02:37 -0200 Message-Id: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Jan Kiszka , Marcelo Tosatti , qemu-devel@nongnu.org, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH 28/31] kvm: Flush coalesced mmio buffer on IO window exits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.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 Signed-off-by: Marcelo Tosatti --- 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: