All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.14] vhost/test: fix build for vhost test
@ 2019-09-11  2:50 Tiwei Bie
  2019-09-11  9:10 ` Greg KH
  2019-09-11  9:16 ` Sasha Levin
  0 siblings, 2 replies; 5+ messages in thread
From: Tiwei Bie @ 2019-09-11  2:50 UTC (permalink / raw)
  To: stable; +Cc: mst, jasowang, gregkh

commit 264b563b8675771834419057cbe076c1a41fb666 upstream.

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>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.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 3cc98c07dcd3..682fc58e1f75 100644
--- a/drivers/vhost/test.c
+++ b/drivers/vhost/test.c
@@ -23,6 +23,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,
@@ -81,10 +87,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);
@@ -116,7 +120,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);
+	vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX,
+		       VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
 
 	f->private_data = n;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.14] vhost/test: fix build for vhost test
  2019-09-11  2:50 [PATCH 4.14] vhost/test: fix build for vhost test Tiwei Bie
@ 2019-09-11  9:10 ` Greg KH
  2019-09-11  9:16 ` Sasha Levin
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2019-09-11  9:10 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: stable, mst, jasowang

On Wed, Sep 11, 2019 at 10:50:55AM +0800, Tiwei Bie wrote:
> commit 264b563b8675771834419057cbe076c1a41fb666 upstream.
> 
> 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>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Acked-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/vhost/test.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.14] vhost/test: fix build for vhost test
  2019-09-11  2:50 [PATCH 4.14] vhost/test: fix build for vhost test Tiwei Bie
  2019-09-11  9:10 ` Greg KH
@ 2019-09-11  9:16 ` Sasha Levin
  2019-09-11  9:35   ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-09-11  9:16 UTC (permalink / raw)
  To: Tiwei Bie; +Cc: stable, mst, jasowang, gregkh

On Wed, Sep 11, 2019 at 10:50:55AM +0800, Tiwei Bie wrote:
>commit 264b563b8675771834419057cbe076c1a41fb666 upstream.
>
>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>
>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>Acked-by: Jason Wang <jasowang@redhat.com>

I've queued it up for 4.14, 4.9, and 4.4. Thank you.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.14] vhost/test: fix build for vhost test
  2019-09-11  9:16 ` Sasha Levin
@ 2019-09-11  9:35   ` Greg KH
  2019-09-11 10:01     ` Sasha Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-09-11  9:35 UTC (permalink / raw)
  To: Sasha Levin; +Cc: Tiwei Bie, stable, mst, jasowang

On Wed, Sep 11, 2019 at 05:16:31AM -0400, Sasha Levin wrote:
> On Wed, Sep 11, 2019 at 10:50:55AM +0800, Tiwei Bie wrote:
> > commit 264b563b8675771834419057cbe076c1a41fb666 upstream.
> > 
> > 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>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Acked-by: Jason Wang <jasowang@redhat.com>
> 
> I've queued it up for 4.14, 4.9, and 4.4. Thank you.

So did I, I think you will get conflicts when you try to merge :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 4.14] vhost/test: fix build for vhost test
  2019-09-11  9:35   ` Greg KH
@ 2019-09-11 10:01     ` Sasha Levin
  0 siblings, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2019-09-11 10:01 UTC (permalink / raw)
  To: Greg KH; +Cc: Tiwei Bie, stable, mst, jasowang

On Wed, Sep 11, 2019 at 10:35:32AM +0100, Greg KH wrote:
>On Wed, Sep 11, 2019 at 05:16:31AM -0400, Sasha Levin wrote:
>> On Wed, Sep 11, 2019 at 10:50:55AM +0800, Tiwei Bie wrote:
>> > commit 264b563b8675771834419057cbe076c1a41fb666 upstream.
>> >
>> > 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>
>> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>> > Acked-by: Jason Wang <jasowang@redhat.com>
>>
>> I've queued it up for 4.14, 4.9, and 4.4. Thank you.
>
>So did I, I think you will get conflicts when you try to merge :)

I did. Good thing we live in different timezones :)

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-09-11 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  2:50 [PATCH 4.14] vhost/test: fix build for vhost test Tiwei Bie
2019-09-11  9:10 ` Greg KH
2019-09-11  9:16 ` Sasha Levin
2019-09-11  9:35   ` Greg KH
2019-09-11 10:01     ` Sasha Levin

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.