mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>, mst@redhat.com
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] vhost/test: fix build for vhost test
Date: Fri, 30 Aug 2019 11:38:16 +0800	[thread overview]
Message-ID: <f74bb96c-b439-7272-bb2f-d2a842dc41a2@redhat.com> (raw)
In-Reply-To: <20190828053700.26022-2-tiwei.bie@intel.com>


On 2019/8/28 下午1:37, Tiwei Bie wrote:
> Since vhost_exceeds_weight() was introduced, callers need to specify
> the packet weight and byte weight in vhost_dev_init(). Note that, the
> packet weight isn't counted in this patch to keep the original behavior
> unchanged.
>
> Fixes: e82b9b0727ff ("vhost: introduce vhost_exceeds_weight()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>  drivers/vhost/test.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> index ac4f762c4f65..7804869c6a31 100644
> --- a/drivers/vhost/test.c
> +++ b/drivers/vhost/test.c
> @@ -22,6 +22,12 @@
>   * Using this limit prevents one virtqueue from starving others. */
>  #define VHOST_TEST_WEIGHT 0x80000
>  
> +/* Max number of packets transferred before requeueing the job.
> + * Using this limit prevents one virtqueue from starving others with
> + * pkts.
> + */
> +#define VHOST_TEST_PKT_WEIGHT 256
> +
>  enum {
>  	VHOST_TEST_VQ = 0,
>  	VHOST_TEST_VQ_MAX = 1,
> @@ -80,10 +86,8 @@ static void handle_vq(struct vhost_test *n)
>  		}
>  		vhost_add_used_and_signal(&n->dev, vq, head, 0);
>  		total_len += len;
> -		if (unlikely(total_len >= VHOST_TEST_WEIGHT)) {
> -			vhost_poll_queue(&vq->poll);
> +		if (unlikely(vhost_exceeds_weight(vq, 0, total_len)))
>  			break;
> -		}
>  	}
>  
>  	mutex_unlock(&vq->mutex);
> @@ -115,7 +119,8 @@ static int vhost_test_open(struct inode *inode, struct file *f)
>  	dev = &n->dev;
>  	vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
>  	n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
> -	vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV);
> +	vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
> +		       VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
>  
>  	f->private_data = n;
>  


Acked-by: Jason Wang <jasowang@redhat.com>



  reply	other threads:[~2019-08-30  3:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28  5:36 [PATCH 1/2] " Tiwei Bie
2019-08-28  5:37 ` [PATCH 2/2] " Tiwei Bie
2019-08-30  3:38   ` Jason Wang [this message]
2019-08-30  3:37 ` [PATCH 1/2] " Jason Wang

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=f74bb96c-b439-7272-bb2f-d2a842dc41a2@redhat.com \
    --to=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwei.bie@intel.com \
    --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

all inboxes | Powered by JetHome®