Skip to contentSkip to conversation

Fixes for v5.17

PATCH In review Leon Romanovsky 1 participant 5 messages Mar 27, 2022 – Mar 29, 2022

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

cover Fixes for v5.17

From: Leon Romanovsky <[email protected]>

Aharon Landau (2):
RDMA/mlx5: Don't remove cache MRs when a delay is needed RDMA/mlx5: Add a missing update of cache->last_add

Mark Zhang (1):
IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD

 drivers/infiniband/core/cm.c    | 3 +--
 drivers/infiniband/hw/mlx5/mr.c | 6 ++++--
 2 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/3 RDMA/mlx5: Don't remove cache MRs when a delay is needed

From: Aharon Landau <[email protected]>

Don't remove MRs from the cache if need to delay the removal.

Fixes b9358bdbc713 ("RDMA/mlx5: Fix locking in MR cache work queue")
---
 drivers/infiniband/hw/mlx5/mr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/mr.c +3 -2
index 8a87a2f074e4..4a01a0ad7c90 100644
@@ -562,9 +562,10 @@ static void __cache_work_func(struct mlx5_cache_ent *ent)
 		spin_lock_irq(&ent->lock);
 		if (ent->disabled)
 			goto out;
-		if (need_delay)
+		if (need_delay) {
 			queue_delayed_work(cache->wq, &ent->dwork, 300 * HZ);
-		remove_cache_mr_locked(ent);
+			goto out;
+		}
 		queue_adjust_cache_locked(ent);
 	}
 out:
Signature · 1 line
2.35.1
#2 lore raw

Re: [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed

Quoted 17 lines · Leon Romanovsky

From: Aharon Landau <[email protected]>

Don't remove MRs from the cache if need to delay the removal.

Fixes b9358bdbc713 ("RDMA/mlx5: Fix locking in MR cache work queue")
---
 drivers/infiniband/hw/mlx5/mr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/mr.c +0 -0
index 8a87a2f074e4..4a01a0ad7c90 100644

drivers/infiniband/hw/mlx5/mr.c static void __cache_work_func(struct mlx5_cache_ent *ent) · line 567

Quoted 7 lines
drivers/infiniband/hw/mlx5/mr.c +1 -2
@@ -562,9 +562,10 @@ static void __cache_work_func(struct mlx5_cache_ent *ent)
 		spin_lock_irq(&ent->lock);
 		if (ent->disabled)
 			goto out;
-		if (need_delay)
+		if (need_delay) {
 			queue_delayed_work(cache->wq, &ent->dwork, 300 * HZ);
-		remove_cache_mr_locked(ent);

This is rebase error and remove_cache_mr_locked() shouldn't be removed.

drivers/infiniband/hw/mlx5/mr.c +3 -1
index 8a87a2f074e4..fc5bc8ff1c57 100644
@@ -562,8 +562,10 @@ static void __cache_work_func(struct mlx5_cache_ent *ent)
                spin_lock_irq(&ent->lock);
                if (ent->disabled)
                        goto out;
-               if (need_delay)
+               if (need_delay) {
                        queue_delayed_work(cache->wq, &ent->dwork, 300 * HZ);
+                       goto out;
+               }
                remove_cache_mr_locked(ent);
                queue_adjust_cache_locked(ent);
        }
Quoted 8 lines
drivers/infiniband/hw/mlx5/mr.c +2 -0
+			goto out;
+		}
 		queue_adjust_cache_locked(ent);
 	}
 out:
Signature · 1 line
2.35.1
#3 lore raw

PATCH 2/3 RDMA/mlx5: Add a missing update of cache->last_add

In reply to Leon Romanovsky

From: Aharon Landau <[email protected]>

Update cache->last_add when returning an MR to the cache so that the cache work won't remove it.

Fixes b9358bdbc713 ("RDMA/mlx5: Fix locking in MR cache work queue")
---
 drivers/infiniband/hw/mlx5/mr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/mlx5/mr.c +1 -0
index 4a01a0ad7c90..1eef74b952b6 100644
@@ -614,6 +614,7 @@ static void mlx5_mr_cache_free(struct mlx5_ib_dev *dev, struct mlx5_ib_mr *mr)
 {
 	struct mlx5_cache_ent *ent = mr->cache_ent;
 
+	WRITE_ONCE(dev->cache.last_add, jiffies);
 	spin_lock_irq(&ent->lock);
 	list_add_tail(&mr->list, &ent->head);
 	ent->available_mrs++;
Signature · 1 line
2.35.1
#4 lore raw

PATCH 3/3 IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD

In reply to Leon Romanovsky

From: Mark Zhang <[email protected]>

On the passive side when the DREQ event comes, if the current state is MRA_REP_RCVD, it needs to cancel the MAD before enter the DREQ_RCVD and TIMEWAIT state, otherwise the destroy_id may block until this mad will reach timeout.

Fixes a977049dacde ("[PATCH] IB: Add the kernel CM implementation")
---
 drivers/infiniband/core/cm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/core/cm.c +1 -2
index c903b74f46a4..add21a82c428 100644
@@ -2824,6 +2824,7 @@ static int cm_dreq_handler(struct cm_work *work)
 	switch (cm_id_priv->id.state) {
 	case IB_CM_REP_SENT:
 	case IB_CM_DREQ_SENT:
+	case IB_CM_MRA_REP_RCVD:
 		ib_cancel_mad(cm_id_priv->msg);
 		break;
 	case IB_CM_ESTABLISHED:
@@ -2831,8 +2832,6 @@ static int cm_dreq_handler(struct cm_work *work)
 		    cm_id_priv->id.lap_state == IB_CM_MRA_LAP_RCVD)
 			ib_cancel_mad(cm_id_priv->msg);
 		break;
-	case IB_CM_MRA_REP_RCVD:
-		break;
 	case IB_CM_TIMEWAIT:
 		atomic_long_inc(&work->port->counters[CM_RECV_DUPLICATES]
 						     [CM_DREQ_COUNTER]);
Signature · 1 line
2.35.1