netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sridhar Samudrala <sri@us.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next-2.6] vhost: Restart tx poll when socket send queue is full
Date: Fri, 19 Feb 2010 13:19:45 -0800	[thread overview]
Message-ID: <1266614385.17881.7.camel@w-sridhar.beaverton.ibm.com> (raw)
In-Reply-To: <20100219144203.GD14847@redhat.com>

On Fri, 2010-02-19 at 16:42 +0200, Michael S. Tsirkin wrote:

> > > Hmm. We already do
> > >                        if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
> > >                                 tx_poll_start(net, sock);
> > >                                 set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
> > >                                 break;
> > >                         }
> > > why does not this code trigger here?
> > 
> > This check is done only when the ring is empty(head == vq->num).
> > But we are breaking out of the loop here.
> >                 if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
> >                         vhost_poll_queue(&vq->poll);
> >                         break;
> >                 }
> > 
> > I guess tx_poll_start() is missing here. The following patch fixes
> > the hang and may be a better fix.
> > 
> > Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> > 
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 4c89283..fe9d296 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -172,6 +172,7 @@ static void handle_tx(struct vhost_net *net)
> >  		vhost_add_used_and_signal(&net->dev, vq, head, 0);
> >  		total_len += len;
> >  		if (unlikely(total_len >= VHOST_NET_WEIGHT)) {
> > +			tx_poll_start(net, sock);
> >  			vhost_poll_queue(&vq->poll);
> >  			break;
> >  		}
> > 
> > Thanks
> > Sridhar
> 
> 
> Hmm, this happens when
> we have polled a lot of packets, and want to
> give another vq a chance to poll.
> Looks like a strange place to add it.

I am also seeing sendmsg() calls failing with EAGAIN. Could be a bug in
handling this error. The check for sendq full is done outside the for
loop. It is possible that we can run out of sendq space within the for
loop. Should we check for wmem within the for loop?

Thanks
Sridhar


  reply	other threads:[~2010-02-19 21:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 20:59 [PATCH net-next-2.6] vhost: Restart tx poll when socket send queue is full Sridhar Samudrala
2010-02-18 22:30 ` Michael S. Tsirkin
2010-02-19  2:00   ` Sridhar Samudrala
2010-02-19 14:42     ` Michael S. Tsirkin
2010-02-19 21:19       ` Sridhar Samudrala [this message]
2010-02-23 10:24 ` Michael S. Tsirkin
2010-02-23 17:31   ` Sridhar Samudrala
2010-02-26  3:09     ` Shirley Ma

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=1266614385.17881.7.camel@w-sridhar.beaverton.ibm.com \
    --to=sri@us.ibm.com \
    --cc=davem@davemloft.net \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.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).