From: Koichiro Den <den@klaipeden.com>
To: Jason Wang <jasowang@redhat.com>, mst@redhat.com
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 2/2] vhost-net: revert vhost_exceeds_maxpend logic to its original
Date: Mon, 21 Aug 2017 22:30:05 +0900 [thread overview]
Message-ID: <1503322205.8694.7.camel@klaipeden.com> (raw)
In-Reply-To: <0cbc33d6-eb1e-cea4-4cdf-a8a88932da62@redhat.com>
On Mon, 2017-08-21 at 11:06 +0800, Jason Wang wrote:
>
> On 2017年08月19日 14:41, Koichiro Den wrote:
> > To depend on vq.num and the usage of VHOST_MAX_PEND is not succinct
> > and in some case unexpected, so revert its logic part only.
>
> Hi:
>
> Could you explain a little bit more on the case that is was not sufficent?
It's just because vq.num could theoretically be around VHOST_MAX_PEND, that
could lead to an unexpected situation. Plus, I thought its name and usage is not
intrinsic. Its actual functioning in normal vq.num == 256 case is I think good
enough. Thanks.
>
> Thanks
>
> >
> > Signed-off-by: Koichiro Den <den@klaipeden.com>
> > ---
> > drivers/vhost/net.c | 8 ++++++--
> > 1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index 06d044862e58..99cf99b308a7 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -433,11 +433,15 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net
> > *net,
> >
> > static bool vhost_exceeds_maxpend(struct vhost_net *net)
> > {
> > + int num_pends;
> > struct vhost_net_virtqueue *nvq = &net->vqs[VHOST_NET_VQ_TX];
> > struct vhost_virtqueue *vq = &nvq->vq;
> >
> > - return (nvq->upend_idx + vq->num - VHOST_MAX_PEND) % UIO_MAXIOV
> > - == nvq->done_idx;
> > + num_pends = likely(nvq->upend_idx >= nvq->done_idx) ?
> > + (nvq->upend_idx - nvq->done_idx) :
> > + (nvq->upend_idx + UIO_MAXIOV - nvq->done_idx);
> > +
> > + return num_pends > VHOST_MAX_PEND;
> > }
> >
> > /* Expects to be always run from workqueue - which acts as
>
>
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2017-08-21 13:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-19 6:41 [PATCH 2/2] vhost-net: revert vhost_exceeds_maxpend logic to its original Koichiro Den
2017-08-21 3:06 ` Jason Wang
2017-08-21 12:40 ` Jason Wang
2017-08-21 13:32 ` Koichiro Den
2017-08-21 13:30 ` Koichiro Den [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-08-19 6:41 Koichiro Den
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=1503322205.8694.7.camel@klaipeden.com \
--to=den@klaipeden.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.