Skip to contentSkip to conversation

mlx4: Invoke softirqs after napi_reschedule

PATCH In review Benjamin Poirier 6 participants 6 messages Feb 6, 2017 – Feb 7, 2017 2 messages not in the archive

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

PATCH 1/1 mlx4: Invoke softirqs after napi_reschedule

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.

---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +2 -0
index eac527e25ec9..14ce1549b638 100644
@@ -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
Signature · 1 line
2.11.0
#2 lore raw
In reply to a message not in the archive
Quoted 20 lines · Benjamin Poirier

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.

---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +0 -0
index eac527e25ec9..14ce1549b638 100644
@@ -513,10 +513,12 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
 	if (!priv->port_up)

drivers/net/ethernet/mellanox/mlx4/en_rx.c void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv) · line 523

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx4/en_rx.c +2 -0
 		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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

PATCH v2 1/1 mlx4: Invoke softirqs after napi_reschedule

In reply to a message not in the archive

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 <[email protected]>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +4 -1
index eac527e25ec9..cc003fdf0ed9 100644
@@ -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();
+		}
 	}
 }
 
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by on v2 1/1
#5 lore raw
Quoted 8 lines · Benjamin Poirier

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.

Quoted 6 lines
Fixes 07841f9d94c1 ("net/mlx4_en: Schedule napi when RX buffers allocation fails")
Cc Eric Dumazet <[email protected]>
---
 drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Thanks

Reviewed-by on v2 1/1
#6 lore raw
In reply to Benjamin Poirier
Quoted 22 lines · Benjamin Poirier

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 <[email protected]>
---
  drivers/net/ethernet/mellanox/mlx4/en_rx.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx4/en_rx.c +0 -0
index eac527e25ec9..cc003fdf0ed9 100644
@@ -514,8 +514,11 @@ void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv)
  		return;
 

drivers/net/ethernet/mellanox/mlx4/en_rx.c void mlx4_en_recover_from_oom(struct mlx4_en_priv *priv) · line 524

Quoted 10 lines
drivers/net/ethernet/mellanox/mlx4/en_rx.c +4 -1
  	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();
+		}
  	}
  }
 

Thanks!

maintainer
#7 lore raw
In reply to Benjamin Poirier

From: Benjamin Poirier <[email protected]>
Date: Mon, 6 Feb 2017 10:14:31 -0800

Quoted 11 lines

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 <[email protected]>

Applied and queued up for -stable, thanks!