Skip to contentSkip to conversation

mlx4_en: don't use napi_synchronize inside mlx4_en_netpoll

PATCH In review Chris Mason 2 participants 2 messages Apr 15, 2014 – Apr 16, 2014

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

PATCH 1/1 mlx4_en: don't use napi_synchronize inside mlx4_en_netpoll

The mlx4 driver is triggering schedules while atomic inside mlx4_en_netpoll:

	spin_lock_irqsave(&cq->lock, flags);
	napi_synchronize(&cq->napi);
		^^^^^ msleep here
	mlx4_en_process_rx_cq(dev, cq, 0);
	spin_unlock_irqrestore(&cq->lock, flags);

This was part of a patch by Alexander Guller from Mellanox in 2011, but it still isn't upstream.

---
 drivers/net/ethernet/mellanox/mlx4/en_cq.c     | 1 -
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +-----
 drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   | 1 -
 3 files changed, 1 insertion(+), 7 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_cq.c +0 -1
index 70e9532..c2cd8d3 100644
@@ -66,7 +66,6 @@ int mlx4_en_create_cq(struct mlx4_en_priv *priv,
 
 	cq->ring = ring;
 	cq->is_tx = mode;
-	spin_lock_init(&cq->lock);
 
 	/* Allocate HW buffers on provided NUMA node.
 	 * dev->numa_node is used in mtt range allocation flow.
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -5
index f085c2d..7e4b172 100644
@@ -1304,15 +1304,11 @@ static void mlx4_en_netpoll(struct net_device *dev)
 {
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 	struct mlx4_en_cq *cq;
-	unsigned long flags;
 	int i;
 
 	for (i = 0; i < priv->rx_ring_num; i++) {
 		cq = priv->rx_cq[i];
-		spin_lock_irqsave(&cq->lock, flags);
-		napi_synchronize(&cq->napi);
-		mlx4_en_process_rx_cq(dev, cq, 0);
-		spin_unlock_irqrestore(&cq->lock, flags);
+		napi_schedule(&cq->napi);
 	}
 }
 #endif
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +0 -1
index 7a733c2..04d9b6fe 100644
@@ -319,7 +319,6 @@ struct mlx4_en_cq {
 	struct mlx4_cq          mcq;
 	struct mlx4_hwq_resources wqres;
 	int                     ring;
-	spinlock_t              lock;
 	struct net_device      *dev;
 	struct napi_struct	napi;
 	int size;
Signature · 1 line
1.8.1
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Chris Mason

The mlx4 driver is triggering schedules while atomic inside mlx4_en_netpoll:

	spin_lock_irqsave(&cq->lock, flags);
	napi_synchronize(&cq->napi);
		^^^^^ msleep here
	mlx4_en_process_rx_cq(dev, cq, 0);
	spin_unlock_irqrestore(&cq->lock, flags);

This was part of a patch by Alexander Guller from Mellanox in 2011, but it still isn't upstream.

Quoted 8 lines
---
  drivers/net/ethernet/mellanox/mlx4/en_cq.c     | 1 -
  drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 6 +-----
  drivers/net/ethernet/mellanox/mlx4/mlx4_en.h   | 1 -
  3 files changed, 1 insertion(+), 7 deletions(-)