Skip to contentSkip to conversation

xen-netfront: Rework the fix for Rx stall during OOM and network stress

PATCH Applied Vineeth Remanan Pillai 3 participants 5 messages Feb 7, 2017 – Feb 9, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen-netfront: Rework the fix for Rx stall during OOM and network stress

The commit 90c311b0eeea ("xen-netfront: Fix Rx stall during network stress and OOM") caused the refill timer to be triggerred almost on all invocations of xennet_alloc_rx_buffers for certain workloads. This reworks the fix by reverting to the old behaviour and taking into consideration the skb allocation failure. Refill timer is now triggered on insufficient requests or skb allocation failure.

Fixes 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)
---
 drivers/net/xen-netfront.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/net/xen-netfront.c +11 -3
index 8315fe7..9dba697 100644
@@ -281,6 +281,7 @@ static void xennet_alloc_rx_buffers(struct netfront_queue *queue)
 {
 	RING_IDX req_prod = queue->rx.req_prod_pvt;
 	int notify;
+	int err = 0;
 
 	if (unlikely(!netif_carrier_ok(queue->info->netdev)))
 		return;
@@ -295,8 +296,10 @@ static void xennet_alloc_rx_buffers(struct netfront_queue *queue)
 		struct xen_netif_rx_request *req;
 
 		skb = xennet_alloc_one_rx_buffer(queue);
-		if (!skb)
+		if (!skb) {
+			err = -ENOMEM;
 			break;
+		}
 
 		id = xennet_rxidx(req_prod);
 
@@ -320,8 +323,13 @@ static void xennet_alloc_rx_buffers(struct netfront_queue *queue)
 
 	queue->rx.req_prod_pvt = req_prod;
 
-	/* Not enough requests? Try again later. */
-	if (req_prod - queue->rx.sring->req_prod < NET_RX_SLOTS_MIN) {
+	/* Try again later if there are not enough requests or skb allocation
+	 * failed.
+	 * Enough requests is quantified as the sum of newly created slots and
+	 * the unconsumed slots at the backend.
+	 */
+	if (req_prod - queue->rx.rsp_cons < NET_RX_SLOTS_MIN ||
+	    unlikely(err)) {
 		mod_timer(&queue->rx_refill_timer, jiffies + (HZ/10));
 		return;
 	}
Signature · 1 line
2.1.2.AMZN
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Vineeth Remanan Pillai

The commit 90c311b0eeea ("xen-netfront: Fix Rx stall during network stress and OOM") caused the refill timer to be triggerred almost on all invocations of xennet_alloc_rx_buffers for certain workloads. This reworks the fix by reverting to the old behaviour and taking into consideration the skb allocation failure. Refill timer is now triggered on insufficient requests or skb allocation failure.

Fixes 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Vineeth Remanan Pillai
Quoted 10 lines · Vineeth Remanan Pillai

The commit 90c311b0eeea ("xen-netfront: Fix Rx stall during network stress and OOM") caused the refill timer to be triggerred almost on all invocations of xennet_alloc_rx_buffers for certain workloads. This reworks the fix by reverting to the old behaviour and taking into consideration the skb allocation failure. Refill timer is now triggered on insufficient requests or skb allocation failure.

Fixes 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)
maintainer Applied
#3 lore raw
In reply to Vineeth Remanan Pillai

From: Vineeth Remanan Pillai <[email protected]>
Date: Tue, 7 Feb 2017 18:59:01 +0000

Quoted 10 lines

The commit 90c311b0eeea ("xen-netfront: Fix Rx stall during network stress and OOM") caused the refill timer to be triggerred almost on all invocations of xennet_alloc_rx_buffers for certain workloads. This reworks the fix by reverting to the old behaviour and taking into consideration the skb allocation failure. Refill timer is now triggered on insufficient requests or skb allocation failure.

Fixes 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)

Applied.

maintainer Applied
#4 lore raw
In reply to Vineeth Remanan Pillai

From: Vineeth Remanan Pillai <[email protected]>
Date: Tue, 7 Feb 2017 18:59:01 +0000

Quoted 10 lines

The commit 90c311b0eeea ("xen-netfront: Fix Rx stall during network stress and OOM") caused the refill timer to be triggerred almost on all invocations of xennet_alloc_rx_buffers for certain workloads. This reworks the fix by reverting to the old behaviour and taking into consideration the skb allocation failure. Refill timer is now triggered on insufficient requests or skb allocation failure.

Fixes 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)

Applied.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel