[kernel/f14/master] add virtio_net-add-schedule-check-to-napi_enable-call.patch

Kyle McMartin kyle at fedoraproject.org
Wed Mar 23 16:44:21 UTC 2011


commit 21c6036496ba81633cd766c6197171a1aa02d2d1
Author: Kyle McMartin <kyle at redhat.com>
Date:   Wed Mar 23 12:38:11 2011 -0400

    add virtio_net-add-schedule-check-to-napi_enable-call.patch

 kernel.spec                                        |    7 ++
 ...et-add-schedule-check-to-napi_enable-call.patch |   76 ++++++++++++++++++++
 2 files changed, 83 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 9ffe1b4..06c837f 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -851,6 +851,8 @@ Patch13711: md-fix-regression-resulting-in-delays-in-clearing-bits-in-a-bitmap.p
 # rhbz#671514
 Patch13712: cfg80211-fix-can_beacon_sec_chan-reenable-ht40.patch
 
+Patch13713: virtio_net-add-schedule-check-to-napi_enable-call.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1607,6 +1609,8 @@ ApplyPatch md-fix-regression-resulting-in-delays-in-clearing-bits-in-a-bitmap.pa
 # rhbz#671514
 ApplyPatch cfg80211-fix-can_beacon_sec_chan-reenable-ht40.patch
 
+ApplyPatch virtio_net-add-schedule-check-to-napi_enable-call.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2193,6 +2197,9 @@ fi
 # and build.
 
 %changelog
+* Wed Mar 23 2011 Kyle McMartin <kmcmartin at redhat.com>
+- Backport 3e9d08e: "virtio_net: Add schedule check to napi_enable call"
+
 * Wed Mar 23 2011 Ben Skeggs <bskeggs at redhat.com> 2.6.35.11-87
 - nouveau: fix s/r on some boards (f14 port of #688569)
 
diff --git a/virtio_net-add-schedule-check-to-napi_enable-call.patch b/virtio_net-add-schedule-check-to-napi_enable-call.patch
new file mode 100644
index 0000000..c61dd36
--- /dev/null
+++ b/virtio_net-add-schedule-check-to-napi_enable-call.patch
@@ -0,0 +1,76 @@
+From b5740f0377e4fb924517b68f9a7ad7f5647fe8ac Mon Sep 17 00:00:00 2001
+From: Bruce Rogers <brogers at novell.com>
+Date: Thu, 10 Feb 2011 11:03:31 -0800
+Subject: [PATCH] virtio_net: Add schedule check to napi_enable call
+
+Under harsh testing conditions, including low memory, the guest would
+stop receiving packets. With this patch applied we no longer see any
+problems in the driver while performing these tests for extended periods
+of time.
+
+Make sure napi is scheduled subsequent to each napi_enable.
+
+Signed-off-by: Bruce Rogers <brogers at novell.com>
+Signed-off-by: Olaf Kirch <okir at suse.de>
+Cc: stable at kernel.org
+Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/virtio_net.c |   27 ++++++++++++++++-----------
+ 1 files changed, 16 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
+index bb6b67f..1cf8da8 100644
+--- a/drivers/net/virtio_net.c
++++ b/drivers/net/virtio_net.c
+@@ -446,6 +446,20 @@ static void skb_recv_done(struct virtqueue *rvq)
+ 	}
+ }
+ 
++static void virtnet_napi_enable(struct virtnet_info *vi)
++{
++	napi_enable(&vi->napi);
++
++	/* If all buffers were filled by other side before we napi_enabled, we
++	 * won't get another interrupt, so process any outstanding packets
++	 * now.  virtnet_poll wants re-enable the queue, so we disable here.
++	 * We synchronize against interrupts via NAPI_STATE_SCHED */
++	if (napi_schedule_prep(&vi->napi)) {
++		virtqueue_disable_cb(vi->rvq);
++		__napi_schedule(&vi->napi);
++	}
++}
++
+ static void refill_work(struct work_struct *work)
+ {
+ 	struct virtnet_info *vi;
+@@ -454,7 +468,7 @@ static void refill_work(struct work_struct *work)
+ 	vi = container_of(work, struct virtnet_info, refill.work);
+ 	napi_disable(&vi->napi);
+ 	still_empty = !try_fill_recv(vi, GFP_KERNEL);
+-	napi_enable(&vi->napi);
++	virtnet_napi_enable(vi);
+ 
+ 	/* In theory, this can happen: if we don't get any buffers in
+ 	 * we will *never* try to fill again. */
+@@ -638,16 +652,7 @@ static int virtnet_open(struct net_device *dev)
+ {
+ 	struct virtnet_info *vi = netdev_priv(dev);
+ 
+-	napi_enable(&vi->napi);
+-
+-	/* If all buffers were filled by other side before we napi_enabled, we
+-	 * won't get another interrupt, so process any outstanding packets
+-	 * now.  virtnet_poll wants re-enable the queue, so we disable here.
+-	 * We synchronize against interrupts via NAPI_STATE_SCHED */
+-	if (napi_schedule_prep(&vi->napi)) {
+-		virtqueue_disable_cb(vi->rvq);
+-		__napi_schedule(&vi->napi);
+-	}
++	virtnet_napi_enable(vi);
+ 	return 0;
+ }
+ 
+-- 
+1.7.4.1
+


More information about the scm-commits mailing list