diff mbox

[net] mlx4: Invoke softirqs after napi_reschedule

Message ID 20170206171046.3765-1-bpoirier@suse.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Benjamin Poirier Feb. 6, 2017, 5:10 p.m. UTC
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(+)

Comments

Eric Dumazet Feb. 6, 2017, 5:54 p.m. UTC | #1
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@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();
>  }
>  

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.
diff mbox

Patch

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