From patchwork Wed Apr 21 05:57:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshiaki Tamura X-Patchwork-Id: 50630 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 E5CC9B6EEB for ; Wed, 21 Apr 2010 16:57:01 +1000 (EST) Received: from localhost ([127.0.0.1]:40044 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4TpP-00008x-JJ for incoming@patchwork.ozlabs.org; Wed, 21 Apr 2010 02:54:31 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O4T0w-0003Lu-7Y for qemu-devel@nongnu.org; Wed, 21 Apr 2010 02:02:22 -0400 Received: from [140.186.70.92] (port=36858 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O4T0S-00035I-Py for qemu-devel@nongnu.org; Wed, 21 Apr 2010 02:02:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O4T0B-0006h0-Ff for qemu-devel@nongnu.org; Wed, 21 Apr 2010 02:01:51 -0400 Received: from sh.osrg.net ([192.16.179.4]:35936) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O4T09-0006e8-9v for qemu-devel@nongnu.org; Wed, 21 Apr 2010 02:01:33 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id o3L61Qhd004086; Wed, 21 Apr 2010 15:01:27 +0900 Received: from localhost (hype-wd0.osrg.net [10.72.1.16]) by fs.osrg.net (Postfix) with ESMTP id 556053E0300; Wed, 21 Apr 2010 15:01:25 +0900 (JST) From: Yoshiaki Tamura To: kvm@vger.kernel.org, qemu-devel@nongnu.org Date: Wed, 21 Apr 2010 14:57:24 +0900 Message-Id: <1271829445-5328-20-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Mailer: git-send-email 1.7.0.31.g1df487 In-Reply-To: <1271829445-5328-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> References: <1271829445-5328-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> X-Dispatcher: imput version 20070423(IM149) Lines: 75 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Wed, 21 Apr 2010 15:01:27 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: aliguori@us.ibm.com, ohmura.kei@lab.ntt.co.jp, mtosatti@redhat.com, Yoshiaki Tamura , yoshikawa.takuya@oss.ntt.co.jp, avi@redhat.com Subject: [Qemu-devel] [RFC PATCH 19/20] Insert do_event_tap() to virtio-{blk, net}, comment out assert() on cpu_single_env temporally. 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 do_event_tap() is inserted to functions which actually fire outputs. By synchronizing VMs before outputs are fired, we can failover to the receiver upon failure. To save VM continuously, comment out assert() on cpu_single_env temporally. Signed-off-by: Yoshiaki Tamura --- hw/virtio-blk.c | 2 ++ hw/virtio-net.c | 2 ++ qemu-kvm.c | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index b80402d..1dd1c31 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -327,6 +327,8 @@ static void virtio_blk_handle_output(VirtIODevice *vdev, VirtQueue *vq) .old_bs = NULL, }; + do_event_tap(); + while ((req = virtio_blk_get_request(s))) { virtio_blk_handle_request(req, &mrb); } diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 5c0093e..1a32bf3 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -667,6 +667,8 @@ static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) { VirtIONet *n = to_virtio_net(vdev); + do_event_tap(); + if (n->tx_timer_active) { virtio_queue_set_notification(vq, 1); qemu_del_timer(n->tx_timer); diff --git a/qemu-kvm.c b/qemu-kvm.c index 1414f49..769bc95 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -935,8 +935,12 @@ int kvm_run(CPUState *env) post_kvm_run(kvm, env); + /* TODO: we need to prevent tapping events that derived from the + * same VMEXIT. This needs more info from the kernel. */ #if defined(KVM_CAP_COALESCED_MMIO) if (kvm_state->coalesced_mmio) { + /* prevent from tapping events while handling coalesced_mmio */ + event_tap_suspend(); struct kvm_coalesced_mmio_ring *ring = (void *) run + kvm_state->coalesced_mmio * PAGE_SIZE; while (ring->first != ring->last) { @@ -946,6 +950,7 @@ int kvm_run(CPUState *env) smp_wmb(); ring->first = (ring->first + 1) % KVM_COALESCED_MMIO_MAX; } + event_tap_resume(); } #endif @@ -1770,7 +1775,7 @@ static void resume_all_threads(void) { CPUState *penv = first_cpu; - assert(!cpu_single_env); + /* assert(!cpu_single_env); */ while (penv) { penv->stop = 0;