[kernel] r16924 - in dists/squeeze/linux-2.6/debian: . patches/bugfix/all patches/series

Ben Hutchings benh at alioth.debian.org
Mon Feb 21 04:56:17 UTC 2011


Author: benh
Date: Mon Feb 21 04:56:08 2011
New Revision: 16924

Log:
virtio_net: Further fixes for out-of-memory conditions (Closes: #603835)

Added:
   dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-Add-schedule-check-to-napi_enable-call.patch
   dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-fix-oom-handling-on-tx.patch
Modified:
   dists/squeeze/linux-2.6/debian/changelog
   dists/squeeze/linux-2.6/debian/patches/series/31

Modified: dists/squeeze/linux-2.6/debian/changelog
==============================================================================
--- dists/squeeze/linux-2.6/debian/changelog	Mon Feb 21 04:27:59 2011	(r16923)
+++ dists/squeeze/linux-2.6/debian/changelog	Mon Feb 21 04:56:08 2011	(r16924)
@@ -27,6 +27,9 @@
     - sched: Use group weight, idle cpu metrics to fix imbalances during
       idle
     - [openvz,vserver] Revert sched changes since they conflict
+  * virtio_net: Further fixes for out-of-memory conditions (Closes: #603835)
+    - Fix OOM handling on TX
+    - Add schedule check to napi_enable call
 
   [ dann frazier ]
   * xfs: fix information leak using stale NFS handle (CVE-2010-2943)

Added: dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-Add-schedule-check-to-napi_enable-call.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-Add-schedule-check-to-napi_enable-call.patch	Mon Feb 21 04:56:08 2011	(r16924)
@@ -0,0 +1,78 @@
+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
+
+commit 3e9d08ec0a68f6faf718d5a7e050fe5ca0ba004f upstream.
+
+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>
+Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+[bwh: Adjust for 2.6.32]
+---
+ 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 b6d4028..c1689ba 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)) {
++		vi->rvq->vq_ops->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)) {
+-		vi->rvq->vq_ops->disable_cb(vi->rvq);
+-		__napi_schedule(&vi->napi);
+-	}
++	virtnet_napi_enable(vi);
+ 	return 0;
+ }
+ 
+-- 
+1.7.4.1
+

Added: dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-fix-oom-handling-on-tx.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/squeeze/linux-2.6/debian/patches/bugfix/all/virtio_net-fix-oom-handling-on-tx.patch	Mon Feb 21 04:56:08 2011	(r16924)
@@ -0,0 +1,65 @@
+From: Rusty Russell <rusty at rustcorp.com.au>
+Date: Fri, 2 Jul 2010 16:34:01 +0000
+Subject: [PATCH] virtio_net: fix oom handling on tx
+
+commit 58eba97d0774c69b1cf3e5a8ac74419409d1abbf upstream.
+
+virtio net will never try to overflow the TX ring, so the only reason
+add_buf may fail is out of memory. Thus, we can not stop the
+device until some request completes - there's no guarantee anything
+at all is outstanding.
+
+Make the error message clearer as well: error here does not
+indicate queue full.
+
+Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
+Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> (...and avoid TX_BUSY)
+Cc: stable at kernel.org  # .34.x (s/virtqueue_/vi->svq->vq_ops->/)
+Signed-off-by: David S. Miller <davem at davemloft.net>
+---
+ drivers/net/virtio_net.c |   21 +++++++++++++--------
+ 1 files changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
+index ee75711..bb6b67f 100644
+--- a/drivers/net/virtio_net.c
++++ b/drivers/net/virtio_net.c
+@@ -562,7 +562,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
+ 	struct virtnet_info *vi = netdev_priv(dev);
+ 	int capacity;
+ 
+-again:
+ 	/* Free up any pending old buffers before queueing new ones. */
+ 	free_old_xmit_skbs(vi);
+ 
+@@ -571,14 +570,20 @@ again:
+ 
+ 	/* This can happen with OOM and indirect buffers. */
+ 	if (unlikely(capacity < 0)) {
+-		netif_stop_queue(dev);
+-		dev_warn(&dev->dev, "Unexpected full queue\n");
+-		if (unlikely(!vi->svq->vq_ops->enable_cb(vi->svq))) {
+-			vi->svq->vq_ops->disable_cb(vi->svq);
+-			netif_start_queue(dev);
+-			goto again;
++		if (net_ratelimit()) {
++			if (likely(capacity == -ENOMEM)) {
++				dev_warn(&dev->dev,
++					 "TX queue failure: out of memory\n");
++			} else {
++				dev->stats.tx_fifo_errors++;
++				dev_warn(&dev->dev,
++					 "Unexpected TX queue failure: %d\n",
++					 capacity);
++			}
+ 		}
+-		return NETDEV_TX_BUSY;
++		dev->stats.tx_dropped++;
++		kfree_skb(skb);
++		return NETDEV_TX_OK;
+ 	}
+ 	vi->svq->vq_ops->kick(vi->svq);
+ 
+-- 
+1.7.4.1
+

Modified: dists/squeeze/linux-2.6/debian/patches/series/31
==============================================================================
--- dists/squeeze/linux-2.6/debian/patches/series/31	Mon Feb 21 04:27:59 2011	(r16923)
+++ dists/squeeze/linux-2.6/debian/patches/series/31	Mon Feb 21 04:56:08 2011	(r16924)
@@ -30,3 +30,5 @@
 + bugfix/all/iwlwifi-fix-use-after-free-bug-for-paged-rx.patch
 + bugfix/all/iwlwifi-fix-AMSDU-Rx-after-paged-Rx-patch.patch
 + debian/sched-Avoid-ABI-change-in-2.6.32.29.patch
++ bugfix/all/virtio_net-fix-oom-handling-on-tx.patch
++ bugfix/all/virtio_net-Add-schedule-check-to-napi_enable-call.patch



More information about the Kernel-svn-changes mailing list