All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Some kvm-guest-drivers-linux/virtio_net fixes
@ 2008-10-22 15:20 Mark McLoughlin
  2008-10-22 15:20 ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Mark McLoughlin
  0 siblings, 1 reply; 5+ messages in thread
From: Mark McLoughlin @ 2008-10-22 15:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm


Hi Avi,
        Here's a few virtio_net fixes for kvm-guest-drivers-linux.

Cheers,
Mark.


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

* [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt
  2008-10-22 15:20 [PATCH 0/3] Some kvm-guest-drivers-linux/virtio_net fixes Mark McLoughlin
@ 2008-10-22 15:20 ` Mark McLoughlin
  2008-10-22 15:20   ` [PATCH 2/3] virtio_net: Make use of napi_weight module param Mark McLoughlin
  2008-10-26 14:17   ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Avi Kivity
  0 siblings, 2 replies; 5+ messages in thread
From: Mark McLoughlin @ 2008-10-22 15:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Mark McLoughlin

If after receiving some packets and refilling the queue with buffers,
we detect that more packets are available then we re-schedule the
queue and process them.

This re-scheduling - i.e. calling __netif_rx_schedule() - causes a
netdev reference to be taken.

Once we've finally run out of buffers to process, we return zero and
net_rx_action() drops the reference taken by the original call to
_netif_rx_schedule() in e.g. skb_recv_done().

The reference taken by re-scheduling is always leaked, leading to:

      waiting for eth0 to become free. Usage count = 132568

Fix by immediately dropping the extra reference taken.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hack-module.awk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hack-module.awk b/hack-module.awk
index 7cb9381..b401aae 100644
--- a/hack-module.awk
+++ b/hack-module.awk
@@ -63,6 +63,7 @@
     print "	if (!no_work && netif_rx_schedule_prep(vi->dev)) {";
     print "		vi->rvq->vq_ops->disable_cb(vi->rvq);";
     print "		__netif_rx_schedule(vi->dev);";
+    print "		dev_put(vi->dev);";
     print "		goto again;";
     print "	}";
     print "";
-- 
1.5.5.1


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

* [PATCH 2/3] virtio_net: Make use of napi_weight module param
  2008-10-22 15:20 ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Mark McLoughlin
@ 2008-10-22 15:20   ` Mark McLoughlin
  2008-10-22 15:20     ` [PATCH 3/3] virtio_net: support ethtool offload queries Mark McLoughlin
  2008-10-26 14:17   ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Avi Kivity
  1 sibling, 1 reply; 5+ messages in thread
From: Mark McLoughlin @ 2008-10-22 15:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Mark McLoughlin, Anthony Liguori

Currently, the napi_weight module param is ignored and
we hardcode the weight to 16 since this commit:

    commit 85a8b9da078977c6198d434837c7d077669c9c54
    Author: Anthony Liguori <aliguori@us.ibm.com>
    Date:   Sun Jan 6 21:37:01 2008 -0600

      Make sure to set weight to 16 always.

      Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Allowing the weight to be higher should reduce the interrupt
rate in the guest. In practice, though, it doesn't appear to
make much difference.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
---
 external-module-compat.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/external-module-compat.h b/external-module-compat.h
index 4da2296..fc20bc9 100644
--- a/external-module-compat.h
+++ b/external-module-compat.h
@@ -65,7 +65,7 @@ struct napi_struct {
 #define netif_napi_add(dev, napi, pollfn, weightval)	\
 do {							\
 	(dev)->poll = (pollfn);				\
-	(dev)->weight = 16;				\
+	(dev)->weight = (weightval);                    \
 } while(0)
 #define netif_rx_schedule(dev, napi) netif_rx_schedule(dev)
 
-- 
1.5.5.1


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

* [PATCH 3/3] virtio_net: support ethtool offload queries
  2008-10-22 15:20   ` [PATCH 2/3] virtio_net: Make use of napi_weight module param Mark McLoughlin
@ 2008-10-22 15:20     ` Mark McLoughlin
  0 siblings, 0 replies; 5+ messages in thread
From: Mark McLoughlin @ 2008-10-22 15:20 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm, Mark McLoughlin

Since 2.6.24, if get_tx_csum, get_sg or get_tso are NULL then the
default ethtool_op_get_xxx functions are called. Before 2.6.24,
however, these need to be manually hooked in.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 hack-module.awk |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hack-module.awk b/hack-module.awk
index b401aae..4bb5317 100644
--- a/hack-module.awk
+++ b/hack-module.awk
@@ -148,6 +148,12 @@
     need_endif = 1;
 }
 
+/.set_tx_csum = virtnet_set_tx_csum,/ {
+    print "\t.get_tx_csum = ethtool_op_get_tx_csum,";
+    print "\t.get_sg = ethtool_op_get_sg,";
+    print "\t.get_tso = ethtool_op_get_tso,";
+}
+
 { sub(/\<pci_dev->revision\>/, "pci_dev_revision(pci_dev)") }
 
 { print }
-- 
1.5.5.1


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

* Re: [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt
  2008-10-22 15:20 ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Mark McLoughlin
  2008-10-22 15:20   ` [PATCH 2/3] virtio_net: Make use of napi_weight module param Mark McLoughlin
@ 2008-10-26 14:17   ` Avi Kivity
  1 sibling, 0 replies; 5+ messages in thread
From: Avi Kivity @ 2008-10-26 14:17 UTC (permalink / raw)
  To: Mark McLoughlin; +Cc: Avi Kivity, kvm

Mark McLoughlin wrote:
> If after receiving some packets and refilling the queue with buffers,
> we detect that more packets are available then we re-schedule the
> queue and process them.
>
> This re-scheduling - i.e. calling __netif_rx_schedule() - causes a
> netdev reference to be taken.
>
> Once we've finally run out of buffers to process, we return zero and
> net_rx_action() drops the reference taken by the original call to
> _netif_rx_schedule() in e.g. skb_recv_done().
>
> The reference taken by re-scheduling is always leaked, leading to:
>
>       waiting for eth0 to become free. Usage count = 132568
>
> Fix by immediately dropping the extra reference taken.
>   

Applied all three, thanks.

-- 
error compiling committee.c: too many arguments to function


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

end of thread, other threads:[~2008-10-26 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-22 15:20 [PATCH 0/3] Some kvm-guest-drivers-linux/virtio_net fixes Mark McLoughlin
2008-10-22 15:20 ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Mark McLoughlin
2008-10-22 15:20   ` [PATCH 2/3] virtio_net: Make use of napi_weight module param Mark McLoughlin
2008-10-22 15:20     ` [PATCH 3/3] virtio_net: support ethtool offload queries Mark McLoughlin
2008-10-26 14:17   ` [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt Avi Kivity

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.