From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O52Fl-0003nw-Sb for qemu-devel@nongnu.org; Thu, 22 Apr 2010 15:40:01 -0400 Received: from [140.186.70.92] (port=43251 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O52Fj-0003mY-Mt for qemu-devel@nongnu.org; Thu, 22 Apr 2010 15:40:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O52Fc-00006A-EF for qemu-devel@nongnu.org; Thu, 22 Apr 2010 15:39:56 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:53514) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O52Fc-00005y-B4 for qemu-devel@nongnu.org; Thu, 22 Apr 2010 15:39:52 -0400 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e7.ny.us.ibm.com (8.14.3/8.13.1) with ESMTP id o3MJUDRa006924 for ; Thu, 22 Apr 2010 15:30:13 -0400 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o3MJdpGc155774 for ; Thu, 22 Apr 2010 15:39:51 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o3MJdpe5004672 for ; Thu, 22 Apr 2010 16:39:51 -0300 Message-ID: <4BD0A605.5040309@linux.vnet.ibm.com> Date: Thu, 22 Apr 2010 14:39:49 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1271829445-5328-1-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> <1271829445-5328-20-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> In-Reply-To: <1271829445-5328-20-git-send-email-tamura.yoshiaki@lab.ntt.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [RFC PATCH 19/20] Insert do_event_tap() to virtio-{blk, net}, comment out assert() on cpu_single_env temporally. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yoshiaki Tamura Cc: ohmura.kei@lab.ntt.co.jp, kvm@vger.kernel.org, mtosatti@redhat.com, Anthony Liguori , qemu-devel@nongnu.org, yoshikawa.takuya@oss.ntt.co.jp, avi@redhat.com On 04/21/2010 12:57 AM, Yoshiaki Tamura wrote: > 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(-) > This would be better done in the generic layers (the block and net layers respectively). Then it would work with virtio and emulated devices. Regards, Anthony Liguori > 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; >