All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
@ 2011-05-18 22:01 ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-05-18 22:01 UTC (permalink / raw)
  To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved,
	Tom Lendacky, borntraeger, avi
  Cc: Rusty Russell, Michael S. Tsirkin, virtualization, netdev, linux-kernel

The patch  virtio_net: limit xmit polling
got the logic reversed: it polled while we had
capacity not while ring was empty.

Fix it up and clean up a bit by using a for loop.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

OK, turns out that patch was borken. Here's
a fix that survived stress test on my box.
Pushed on my branch, I'll send a rebased series
with Rusty's comments addressed ASAP.

 drivers/net/virtio_net.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9982bd7..c8cd22d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -514,12 +514,14 @@ static bool free_old_xmit_skbs(struct virtnet_info *vi, int capacity)
 	struct sk_buff *skb;
 	unsigned int len;
 	bool c;
+	int n;
+
 	/* We try to free up at least 2 skbs per one sent, so that we'll get
 	 * all of the memory back if they are used fast enough. */
-	int n = 2;
-
-	while ((c = virtqueue_get_capacity(vi->svq) >= capacity) && --n > 0 &&
-	       (skb = virtqueue_get_buf(vi->svq, &len)) != NULL) {
+	for (n = 0;
+	     ((c = virtqueue_get_capacity(vi->svq)) < capacity || n < 2) &&
+	     ((skb = virtqueue_get_buf(vi->svq, &len)));
+	     ++n) {
 		pr_debug("Sent skb %p\n", skb);
 		vi->dev->stats.tx_bytes += skb->len;
 		vi->dev->stats.tx_packets++;
-- 
1.7.5.53.gc233e

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

* [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
@ 2011-05-18 22:01 ` Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-05-18 22:01 UTC (permalink / raw)
  To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved, Tom Lendacky
  Cc: Rusty Russell, Michael S. Tsirkin, virtualization, netdev, linux-kernel

The patch  virtio_net: limit xmit polling
got the logic reversed: it polled while we had
capacity not while ring was empty.

Fix it up and clean up a bit by using a for loop.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

OK, turns out that patch was borken. Here's
a fix that survived stress test on my box.
Pushed on my branch, I'll send a rebased series
with Rusty's comments addressed ASAP.

 drivers/net/virtio_net.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9982bd7..c8cd22d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -514,12 +514,14 @@ static bool free_old_xmit_skbs(struct virtnet_info *vi, int capacity)
 	struct sk_buff *skb;
 	unsigned int len;
 	bool c;
+	int n;
+
 	/* We try to free up at least 2 skbs per one sent, so that we'll get
 	 * all of the memory back if they are used fast enough. */
-	int n = 2;
-
-	while ((c = virtqueue_get_capacity(vi->svq) >= capacity) && --n > 0 &&
-	       (skb = virtqueue_get_buf(vi->svq, &len)) != NULL) {
+	for (n = 0;
+	     ((c = virtqueue_get_capacity(vi->svq)) < capacity || n < 2) &&
+	     ((skb = virtqueue_get_buf(vi->svq, &len)));
+	     ++n) {
 		pr_debug("Sent skb %p\n", skb);
 		vi->dev->stats.tx_bytes += skb->len;
 		vi->dev->stats.tx_packets++;
-- 
1.7.5.53.gc233e

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

* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
  2011-05-18 22:01 ` Michael S. Tsirkin
@ 2011-05-19  7:30   ` Rusty Russell
  -1 siblings, 0 replies; 8+ messages in thread
From: Rusty Russell @ 2011-05-19  7:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, habanero, Shirley Ma, Krishna Kumar2, kvm,
	steved, Tom Lendacky, borntraeger, avi
  Cc: Michael S. Tsirkin, virtualization, netdev, linux-kernel

On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> The patch  virtio_net: limit xmit polling
> got the logic reversed: it polled while we had
> capacity not while ring was empty.
> 
> Fix it up and clean up a bit by using a for loop.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> OK, turns out that patch was borken. Here's
> a fix that survived stress test on my box.
> Pushed on my branch, I'll send a rebased series
> with Rusty's comments addressed ASAP.

Normally you would have missed the merge window by now, but I'd really
like this stuff in, so I'm holding it open for this.  I want these patches
in linux-next for at least a few days before I push them.

If you think we're not close enough, please tell me and I'll push
the rest of the virtio patches to Linus now.  

Thanks,
Rusty.

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

* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
@ 2011-05-19  7:30   ` Rusty Russell
  0 siblings, 0 replies; 8+ messages in thread
From: Rusty Russell @ 2011-05-19  7:30 UTC (permalink / raw)
  To: Michael S. Tsirkin, habanero, Shirley Ma, Krishna Kumar2, kvm,
	steved, Tom
  Cc: Michael S. Tsirkin, virtualization, netdev, linux-kernel

On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> The patch  virtio_net: limit xmit polling
> got the logic reversed: it polled while we had
> capacity not while ring was empty.
> 
> Fix it up and clean up a bit by using a for loop.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> OK, turns out that patch was borken. Here's
> a fix that survived stress test on my box.
> Pushed on my branch, I'll send a rebased series
> with Rusty's comments addressed ASAP.

Normally you would have missed the merge window by now, but I'd really
like this stuff in, so I'm holding it open for this.  I want these patches
in linux-next for at least a few days before I push them.

If you think we're not close enough, please tell me and I'll push
the rest of the virtio patches to Linus now.  

Thanks,
Rusty.

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

* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
  2011-05-18 22:01 ` Michael S. Tsirkin
  (?)
@ 2011-05-19  7:30 ` Rusty Russell
  -1 siblings, 0 replies; 8+ messages in thread
From: Rusty Russell @ 2011-05-19  7:30 UTC (permalink / raw)
  To: habanero, Shirley Ma, Krishna Kumar2, kvm, steved
  Cc: netdev, virtualization, linux-kernel, Michael S. Tsirkin

On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> The patch  virtio_net: limit xmit polling
> got the logic reversed: it polled while we had
> capacity not while ring was empty.
> 
> Fix it up and clean up a bit by using a for loop.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> OK, turns out that patch was borken. Here's
> a fix that survived stress test on my box.
> Pushed on my branch, I'll send a rebased series
> with Rusty's comments addressed ASAP.

Normally you would have missed the merge window by now, but I'd really
like this stuff in, so I'm holding it open for this.  I want these patches
in linux-next for at least a few days before I push them.

If you think we're not close enough, please tell me and I'll push
the rest of the virtio patches to Linus now.  

Thanks,
Rusty.

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

* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
  2011-05-19  7:30   ` Rusty Russell
  (?)
  (?)
@ 2011-05-22 17:32   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-05-22 17:32 UTC (permalink / raw)
  To: Rusty Russell
  Cc: habanero, Shirley Ma, Krishna Kumar2, kvm, steved, Tom Lendacky,
	borntraeger, avi, virtualization, netdev, linux-kernel

On Thu, May 19, 2011 at 05:00:17PM +0930, Rusty Russell wrote:
> On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > The patch  virtio_net: limit xmit polling
> > got the logic reversed: it polled while we had
> > capacity not while ring was empty.
> > 
> > Fix it up and clean up a bit by using a for loop.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > 
> > OK, turns out that patch was borken. Here's
> > a fix that survived stress test on my box.
> > Pushed on my branch, I'll send a rebased series
> > with Rusty's comments addressed ASAP.
> 
> Normally you would have missed the merge window by now, but I'd really
> like this stuff in, so I'm holding it open for this.  I want these patches
> in linux-next for at least a few days before I push them.
> 
> If you think we're not close enough, please tell me and I'll push
> the rest of the virtio patches to Linus now.  
> 
> Thanks,
> Rusty.

I think it makes sense to push just the patches you have
applied by now (event index + delayed callback) - the
rest are close but they are guest only patches so very easy to
experiment with out of tree. OTOH if event index misses the
window it makes testing painful as we have to keep patching
both host and guest.

-- 
MST

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

* Re: [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
  2011-05-19  7:30   ` Rusty Russell
  (?)
@ 2011-05-22 17:32   ` Michael S. Tsirkin
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-05-22 17:32 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Krishna Kumar2, habanero, kvm, steved, netdev, Shirley Ma,
	linux-kernel, virtualization, borntraeger, Tom Lendacky, avi

On Thu, May 19, 2011 at 05:00:17PM +0930, Rusty Russell wrote:
> On Thu, 19 May 2011 01:01:25 +0300, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > The patch  virtio_net: limit xmit polling
> > got the logic reversed: it polled while we had
> > capacity not while ring was empty.
> > 
> > Fix it up and clean up a bit by using a for loop.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > 
> > OK, turns out that patch was borken. Here's
> > a fix that survived stress test on my box.
> > Pushed on my branch, I'll send a rebased series
> > with Rusty's comments addressed ASAP.
> 
> Normally you would have missed the merge window by now, but I'd really
> like this stuff in, so I'm holding it open for this.  I want these patches
> in linux-next for at least a few days before I push them.
> 
> If you think we're not close enough, please tell me and I'll push
> the rest of the virtio patches to Linus now.  
> 
> Thanks,
> Rusty.

I think it makes sense to push just the patches you have
applied by now (event index + delayed callback) - the
rest are close but they are guest only patches so very easy to
experiment with out of tree. OTOH if event index misses the
window it makes testing painful as we have to keep patching
both host and guest.

-- 
MST

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

* [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling
@ 2011-05-18 22:01 Michael S. Tsirkin
  0 siblings, 0 replies; 8+ messages in thread
From: Michael S. Tsirkin @ 2011-05-18 22:01 UTC (permalink / raw)
  To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved
  Cc: netdev, virtualization, linux-kernel, Michael S. Tsirkin

The patch  virtio_net: limit xmit polling
got the logic reversed: it polled while we had
capacity not while ring was empty.

Fix it up and clean up a bit by using a for loop.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---

OK, turns out that patch was borken. Here's
a fix that survived stress test on my box.
Pushed on my branch, I'll send a rebased series
with Rusty's comments addressed ASAP.

 drivers/net/virtio_net.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9982bd7..c8cd22d 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -514,12 +514,14 @@ static bool free_old_xmit_skbs(struct virtnet_info *vi, int capacity)
 	struct sk_buff *skb;
 	unsigned int len;
 	bool c;
+	int n;
+
 	/* We try to free up at least 2 skbs per one sent, so that we'll get
 	 * all of the memory back if they are used fast enough. */
-	int n = 2;
-
-	while ((c = virtqueue_get_capacity(vi->svq) >= capacity) && --n > 0 &&
-	       (skb = virtqueue_get_buf(vi->svq, &len)) != NULL) {
+	for (n = 0;
+	     ((c = virtqueue_get_capacity(vi->svq)) < capacity || n < 2) &&
+	     ((skb = virtqueue_get_buf(vi->svq, &len)));
+	     ++n) {
 		pr_debug("Sent skb %p\n", skb);
 		vi->dev->stats.tx_bytes += skb->len;
 		vi->dev->stats.tx_packets++;
-- 
1.7.5.53.gc233e

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

end of thread, other threads:[~2011-05-22 17:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-18 22:01 [PATCH RFC] virtio_net: fix patch: virtio_net: limit xmit polling Michael S. Tsirkin
2011-05-18 22:01 ` Michael S. Tsirkin
2011-05-19  7:30 ` Rusty Russell
2011-05-19  7:30 ` Rusty Russell
2011-05-19  7:30   ` Rusty Russell
2011-05-22 17:32   ` Michael S. Tsirkin
2011-05-22 17:32   ` Michael S. Tsirkin
2011-05-18 22:01 Michael S. Tsirkin

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.