Skip to contentSkip to conversation

Some kvm-guest-drivers-linux/virtio_net fixes

PATCH Applied Mark McLoughlin 2 participants 5 messages Oct 22, 2008 – Oct 26, 2008 KVM

lore
Share & tools
lore
#0 lore raw

cover Some kvm-guest-drivers-linux/virtio_net fixes

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

Cheers,
Mark.

#1 lore raw

PATCH 1/3 virtio_net: Fix leaked netdev->refcnt

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.

---
 hack-module.awk |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hack-module.awk +1 -0
index 7cb9381..b401aae 100644
@@ -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 "";
Signature · 1 line
1.5.5.1
#2 lore raw

PATCH 2/3 virtio_net: Make use of napi_weight module param

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

commit 85a8b9da078977c6198d434837c7d077669c9c54
Author: Anthony Liguori <[email protected]>
Date: Sun Jan 6 21:37:01 2008 -0600

Make sure to set weight to 16 always.

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.

---
 external-module-compat.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
external-module-compat.h +1 -1
index 4da2296..fc20bc9 100644
@@ -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)
 
Signature · 1 line
1.5.5.1
#3 lore raw

PATCH 3/3 virtio_net: support ethtool offload queries

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.

---
 hack-module.awk |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
hack-module.awk +6 -0
index b401aae..4bb5317 100644
@@ -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 }
Signature · 1 line
1.5.5.1
Applied
#4 lore raw

Re: [PATCH 1/3] virtio_net: Fix leaked netdev->refcnt

In reply to Mark McLoughlin
Quoted 11 lines · 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().

Quoted 6 lines

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.

Signature · 1 line
error compiling committee.c: too many arguments to function