From: Christian Borntraeger <borntraeger@de.ibm.com>
To: virtualization@lists.linux-foundation.org
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
Anthony Liguori <aliguori@us.ibm.com>,
Dor Laor <dor.laor@qumranet.com>,
netdev@vger.kernel.org
Subject: Re: virtio_net and SMP guests
Date: Thu, 10 Jan 2008 16:51:58 +0100 [thread overview]
Message-ID: <200801101651.58908.borntraeger@de.ibm.com> (raw)
In-Reply-To: <200801101639.15995.borntraeger@de.ibm.com>
Am Donnerstag, 10. Januar 2008 schrieb Christian Borntraeger:
> Am Donnerstag, 10. Januar 2008 schrieb Christian Borntraeger:
> > Am Dienstag, 18. Dezember 2007 schrieb Rusty Russell:
> > > To me this points to doing interrupt suppression a different way. If
we
> > > have a ->disable_cb() virtio function, and call it before we call
> > > netif_rx_schedule, does that fix it?
> >
> > The fix looks good and I agree with it.
> >
> > There is one problem that I try to find for some days, but the following
> > BUG_ON triggers:
> >
> > static void vring_disable_cb(struct virtqueue *_vq)
> > {
> > struct vring_virtqueue *vq = to_vvq(_vq);
> >
> > START_USE(vq);
> > ----> BUG_ON(vq->vring.avail->flags & VRING_AVAIL_F_NO_INTERRUPT);
> > vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
> > END_USE(vq);
> > }
>
> Ok, I found it:
>
> static int virtnet_open(struct net_device *dev)
> {
> struct virtnet_info *vi = netdev_priv(dev);
> try_fill_recv(vi);
> /* If we didn't even get one input buffer, we're useless. */
> if (vi->num == 0)
> return -ENOMEM;
> ---> int for new packet
> static void skb_recv_done(struct virtqueue *rvq)
> {
> struct virtnet_info *vi = rvq->vdev->priv;
> /* Suppress further interrupts. */
> rvq->vq_ops->disable_cb(rvq);
> netif_rx_schedule(vi->dev, &vi->napi);
> }
> - poll is not yet possible, no softirq
> - return from interrupt
> napi_enable(&vi->napi);
> vi->rvq->vq_ops->disable_cb(vi->rvq);
> ---> BUG: its already disabled
Btw. this problem also happens on single processor guests.
What about the following patch:
---
drivers/net/virtio_net.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
Index: kvm/drivers/net/virtio_net.c
===================================================================
--- kvm.orig/drivers/net/virtio_net.c
+++ kvm/drivers/net/virtio_net.c
@@ -179,9 +179,12 @@ static void try_fill_recv(struct virtnet
static void skb_recv_done(struct virtqueue *rvq)
{
struct virtnet_info *vi = rvq->vdev->priv;
- /* Suppress further interrupts. */
- rvq->vq_ops->disable_cb(rvq);
- netif_rx_schedule(vi->dev, &vi->napi);
+ /* Schedule NAPI, Suppress further interrupts if successful. */
+
+ if (netif_rx_schedule_prep(vi->dev, &vi->napi)) {
+ rvq->vq_ops->disable_cb(rvq);
+ __netif_rx_schedule(vi->dev, &vi->napi);
+ }
}
static int virtnet_poll(struct napi_struct *napi, int budget)
next parent reply other threads:[~2008-01-10 15:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200712141312.05562.borntraeger@de.ibm.com>
[not found] ` <200801101337.40433.borntraeger@de.ibm.com>
[not found] ` <200801101639.15995.borntraeger@de.ibm.com>
2008-01-10 15:51 ` Christian Borntraeger [this message]
2008-01-11 9:53 ` virtio_net and SMP guests Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200801101651.58908.borntraeger@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=dor.laor@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).