From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH 1/3] kvm tools: Make virtio-net kvm__irq_line thread safe Date: Fri, 29 Apr 2011 09:52:02 +0300 Message-ID: References: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Cyrill Gorcunov , Ingo Molnar , Sasha Levin , Prasad Joshi , kvm@vger.kernel.org To: Asias He Return-path: Received: from mail-gx0-f174.google.com ([209.85.161.174]:57541 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752501Ab1D2GwD convert rfc822-to-8bit (ORCPT ); Fri, 29 Apr 2011 02:52:03 -0400 Received: by gxk21 with SMTP id 21so1252706gxk.19 for ; Thu, 28 Apr 2011 23:52:02 -0700 (PDT) In-Reply-To: <1304058985-13833-1-git-send-email-asias.hejun@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Apr 29, 2011 at 9:36 AM, Asias He wrote= : > This patch fixes virtio-net randmom stall > > host $ scp guest:/root/big.guest . > big.guest 42% =A0440MB =A067.7KB/s - stalled - > > Signed-off-by: Asias He > --- > =A0tools/kvm/virtio-net.c | =A0 =A09 +++++++-- > =A01 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/tools/kvm/virtio-net.c b/tools/kvm/virtio-net.c > index 58b3de4..efe06cb 100644 > --- a/tools/kvm/virtio-net.c > +++ b/tools/kvm/virtio-net.c > @@ -77,9 +77,12 @@ static void virtio_net_rx_callback(struct kvm *sel= f, void *param) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0head =3D virt_queue__get_iov(vq, iov, = &out, &in, self); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0len =3D readv(net_device.tap_fd, iov, = in); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0virt_queue__set_used_elem(vq, head, le= n); > - =A0 =A0 =A0 } > > - =A0 =A0 =A0 kvm__irq_line(self, VIRTIO_NET_IRQ, 1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* We should interrupt guest right now,= otherwise latency is huge. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mutex_lock(&net_device.mutex); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 kvm__irq_line(self, VIRTIO_NET_IRQ, 1); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mutex_unlock(&net_device.mutex); > + =A0 =A0 =A0 } > =A0} > > =A0static void virtio_net_tx_callback(struct kvm *self, void *param) Please make that IRQ latency fix a separate patch. Don't we need to do it for TX path as well, btw?