Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575958 > unrolled thread

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

Started byVineeth Remanan Pillai <vineethp@amazon.com>
First post2017-02-07 20:00 +0100
Last post2017-02-09 22:40 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress Vineeth Remanan Pillai <vineethp@amazon.com> - 2017-02-07 20:00 +0100
    Re: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and  network stress Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-02-08 16:10 +0100
    Re: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM  and network stress David Miller <davem@davemloft.net> - 2017-02-09 22:40 +0100

#1575958 — [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress

FromVineeth Remanan Pillai <vineethp@amazon.com>
Date2017-02-07 20:00 +0100
Subject[PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress
Message-ID<t8j9E-6xS-15@gated-at.bofh.it>
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.

Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
Fixes: 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)
Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 drivers/net/xen-netfront.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 8315fe7..9dba697 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -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;
 	}
-- 
2.1.2.AMZN

[toc] | [next] | [standalone]


#1576638 — Re: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress

FromBoris Ostrovsky <boris.ostrovsky@oracle.com>
Date2017-02-08 16:10 +0100
SubjectRe: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress
Message-ID<t8C2B-1TA-1@gated-at.bofh.it>
In reply to#1575958
On 02/07/2017 01:59 PM, Vineeth Remanan Pillai wrote:
> 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.
>
> Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
> Fixes: 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)
> Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

[toc] | [prev] | [next] | [standalone]


#1577971 — Re: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress

FromDavid Miller <davem@davemloft.net>
Date2017-02-09 22:40 +0100
SubjectRe: [PATCH] xen-netfront: Rework the fix for Rx stall during OOM and network stress
Message-ID<t94BA-2X8-1@gated-at.bofh.it>
In reply to#1575958
From: Vineeth Remanan Pillai <vineethp@amazon.com>
Date: Tue, 7 Feb 2017 18:59:01 +0000

> 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.
> 
> Signed-off-by: Vineeth Remanan Pillai <vineethp@amazon.com>
> Fixes: 90c311b0eeea (xen-netfront: Fix Rx stall during network stress and OOM)
> Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web