netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mlx4: Invoke softirqs after napi_reschedule
@ 2017-02-06 17:10 Benjamin Poirier
       [not found] ` <20170206171046.3765-1-bpoirier-IBi9RG/b67k@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Poirier @ 2017-02-06 17:10 UTC (permalink / raw)
  To: netdev; +Cc: Tariq Toukan, Yishai Hadas, linux-rdma, Eric Dumazet

mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
in a deterministic time frame and the following message may be logged:
NOHZ: local_softirq_pending 08

The problem is the same as what was described in commit ec13ee80145c
("virtio_net: invoke softirqs after __napi_schedule") and this patch
applies the same fix to mlx4.

Cc: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index eac527e25ec9..14ce1549b638 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -513,10 +513,12 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
 	if (!priv->port_up)
 		return;
 
+	local_bh_disable();
 	for (ring = 0; ring < priv->rx_ring_num; ring++) {
 		if (mlx4_en_is_ring_empty(priv->rx_ring[ring]))
 			napi_reschedule(&priv->rx_cq[ring]->napi);
 	}
+	local_bh_enable();
 }
 
 /* When the rx ring is running in page-per-packet mode, a released frame can go
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net] mlx4: Invoke softirqs after napi_reschedule
       [not found] ` <20170206171046.3765-1-bpoirier-IBi9RG/b67k@public.gmane.org>
@ 2017-02-06 17:54   ` Eric Dumazet
       [not found]     ` <1486403641.7793.43.camel-XN9IlZ5yJG9HTL0Zs8A6p+yfmBU6pStAUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Dumazet @ 2017-02-06 17:54 UTC (permalink / raw)
  To: Benjamin Poirier
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Tariq Toukan, Yishai Hadas,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Mon, 2017-02-06 at 09:10 -0800, Benjamin Poirier wrote:
> mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
> in a deterministic time frame and the following message may be logged:
> NOHZ: local_softirq_pending 08
> 
> The problem is the same as what was described in commit ec13ee80145c
> ("virtio_net: invoke softirqs after __napi_schedule") and this patch
> applies the same fix to mlx4.
> 
> Cc: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Benjamin Poirier <bpoirier-IBi9RG/b67k@public.gmane.org>
> ---
>  drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index eac527e25ec9..14ce1549b638 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -513,10 +513,12 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
>  	if (!priv->port_up)
>  		return;
>  
> +	local_bh_disable();
>  	for (ring = 0; ring < priv->rx_ring_num; ring++) {
>  		if (mlx4_en_is_ring_empty(priv->rx_ring[ring]))
>  			napi_reschedule(&priv->rx_cq[ring]->napi);
>  	}
> +	local_bh_enable();
>  }
>  

I would prefer having the local_bh_disable()/enable inside the loop,
as done with commit 8cf699ec849f4ca1413cea01289bd7d37dbcc626

This gives more chance to service one queue at a time, avoiding to
capture all queues into one cpu.

Thanks.


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net v2] mlx4: Invoke softirqs after napi_reschedule
       [not found]     ` <1486403641.7793.43.camel-XN9IlZ5yJG9HTL0Zs8A6p+yfmBU6pStAUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
@ 2017-02-06 18:14       ` Benjamin Poirier
  2017-02-06 18:47         ` Eric Dumazet
                           ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Benjamin Poirier @ 2017-02-06 18:14 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA
  Cc: Tariq Toukan, Yishai Hadas, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Eric Dumazet

mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
in a deterministic time frame and the following message may be logged:
NOHZ: local_softirq_pending 08

The problem is the same as what was described in commit ec13ee80145c
("virtio_net: invoke softirqs after __napi_schedule") and this patch
applies the same fix to mlx4.

Fixes: 07841f9d94c1 ("net/mlx4_en: Schedule napi when RX buffers allocation fails")
Cc: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Benjamin Poirier <bpoirier-IBi9RG/b67k@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
index eac527e25ec9..cc003fdf0ed9 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
@@ -514,8 +514,11 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
 		return;
 
 	for (ring = 0; ring < priv->rx_ring_num; ring++) {
-		if (mlx4_en_is_ring_empty(priv->rx_ring[ring]))
+		if (mlx4_en_is_ring_empty(priv->rx_ring[ring])) {
+			local_bh_disable();
 			napi_reschedule(&priv->rx_cq[ring]->napi);
+			local_bh_enable();
+		}
 	}
 }
 
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] mlx4: Invoke softirqs after napi_reschedule
  2017-02-06 18:14       ` [PATCH net v2] " Benjamin Poirier
@ 2017-02-06 18:47         ` Eric Dumazet
  2017-02-07  8:23         ` Tariq Toukan
  2017-02-07 17:51         ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2017-02-06 18:47 UTC (permalink / raw)
  To: Benjamin Poirier; +Cc: netdev, Tariq Toukan, Yishai Hadas, linux-rdma

On Mon, 2017-02-06 at 10:14 -0800, Benjamin Poirier wrote:
> mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
> in a deterministic time frame and the following message may be logged:
> NOHZ: local_softirq_pending 08
> 
> The problem is the same as what was described in commit ec13ee80145c
> ("virtio_net: invoke softirqs after __napi_schedule") and this patch
> applies the same fix to mlx4.
> 
> Fixes: 07841f9d94c1 ("net/mlx4_en: Schedule napi when RX buffers allocation fails")
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> ---
>  drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)


Acked-by: Eric Dumazet <edumazet@google.com>

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] mlx4: Invoke softirqs after napi_reschedule
  2017-02-06 18:14       ` [PATCH net v2] " Benjamin Poirier
  2017-02-06 18:47         ` Eric Dumazet
@ 2017-02-07  8:23         ` Tariq Toukan
  2017-02-07 17:51         ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Tariq Toukan @ 2017-02-07  8:23 UTC (permalink / raw)
  To: Benjamin Poirier, netdev
  Cc: Tariq Toukan, Yishai Hadas, linux-rdma, Eric Dumazet


On 06/02/2017 8:14 PM, Benjamin Poirier wrote:
> mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
> in a deterministic time frame and the following message may be logged:
> NOHZ: local_softirq_pending 08
>
> The problem is the same as what was described in commit ec13ee80145c
> ("virtio_net: invoke softirqs after __napi_schedule") and this patch
> applies the same fix to mlx4.
>
> Fixes: 07841f9d94c1 ("net/mlx4_en: Schedule napi when RX buffers allocation fails")
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
> ---
>   drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> index eac527e25ec9..cc003fdf0ed9 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c
> @@ -514,8 +514,11 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
>   		return;
>   
>   	for (ring = 0; ring < priv->rx_ring_num; ring++) {
> -		if (mlx4_en_is_ring_empty(priv->rx_ring[ring]))
> +		if (mlx4_en_is_ring_empty(priv->rx_ring[ring])) {
> +			local_bh_disable();
>   			napi_reschedule(&priv->rx_cq[ring]->napi);
> +			local_bh_enable();
> +		}
>   	}
>   }
>   
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net v2] mlx4: Invoke softirqs after napi_reschedule
  2017-02-06 18:14       ` [PATCH net v2] " Benjamin Poirier
  2017-02-06 18:47         ` Eric Dumazet
  2017-02-07  8:23         ` Tariq Toukan
@ 2017-02-07 17:51         ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2017-02-07 17:51 UTC (permalink / raw)
  To: bpoirier; +Cc: netdev, tariqt, yishaih, linux-rdma, eric.dumazet

From: Benjamin Poirier <bpoirier@suse.com>
Date: Mon,  6 Feb 2017 10:14:31 -0800

> mlx4 may schedule napi from a workqueue. Afterwards, softirqs are not run
> in a deterministic time frame and the following message may be logged:
> NOHZ: local_softirq_pending 08
> 
> The problem is the same as what was described in commit ec13ee80145c
> ("virtio_net: invoke softirqs after __napi_schedule") and this patch
> applies the same fix to mlx4.
> 
> Fixes: 07841f9d94c1 ("net/mlx4_en: Schedule napi when RX buffers allocation fails")
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Benjamin Poirier <bpoirier@suse.com>

Applied and queued up for -stable, thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-07 17:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06 17:10 [PATCH net] mlx4: Invoke softirqs after napi_reschedule Benjamin Poirier
     [not found] ` <20170206171046.3765-1-bpoirier-IBi9RG/b67k@public.gmane.org>
2017-02-06 17:54   ` Eric Dumazet
     [not found]     ` <1486403641.7793.43.camel-XN9IlZ5yJG9HTL0Zs8A6p+yfmBU6pStAUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2017-02-06 18:14       ` [PATCH net v2] " Benjamin Poirier
2017-02-06 18:47         ` Eric Dumazet
2017-02-07  8:23         ` Tariq Toukan
2017-02-07 17:51         ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).