All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-rc 0/3] Fixes for v5.17
@ 2022-03-27  7:55 Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-03-27  7:55 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Leon Romanovsky, Aharon Landau, linux-rdma, Maor Gottlieb,
	Mark Zhang, Shay Drory

From: Leon Romanovsky <leonro@nvidia.com>

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(-)

-- 
2.35.1


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

* [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed
  2022-03-27  7:55 [PATCH rdma-rc 0/3] Fixes for v5.17 Leon Romanovsky
@ 2022-03-27  7:55 ` Leon Romanovsky
  2022-03-29  7:25   ` Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Add a missing update of cache->last_add Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD Leon Romanovsky
  2 siblings, 1 reply; 5+ messages in thread
From: Leon Romanovsky @ 2022-03-27  7:55 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Aharon Landau, linux-rdma, Maor Gottlieb, Mark Zhang, Shay Drory

From: Aharon Landau <aharonl@nvidia.com>

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

Fixes: b9358bdbc713 ("RDMA/mlx5: Fix locking in MR cache work queue")
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/mr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 8a87a2f074e4..4a01a0ad7c90 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -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:
-- 
2.35.1


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

* [PATCH rdma-rc 2/3] RDMA/mlx5: Add a missing update of cache->last_add
  2022-03-27  7:55 [PATCH rdma-rc 0/3] Fixes for v5.17 Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
@ 2022-03-27  7:55 ` Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD Leon Romanovsky
  2 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-03-27  7:55 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Aharon Landau, linux-rdma, Maor Gottlieb, Mark Zhang, Shay Drory

From: Aharon Landau <aharonl@nvidia.com>

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")
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/mr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 4a01a0ad7c90..1eef74b952b6 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -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++;
-- 
2.35.1


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

* [PATCH rdma-rc 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD
  2022-03-27  7:55 [PATCH rdma-rc 0/3] Fixes for v5.17 Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
  2022-03-27  7:55 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Add a missing update of cache->last_add Leon Romanovsky
@ 2022-03-27  7:55 ` Leon Romanovsky
  2 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-03-27  7:55 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Mark Zhang, Aharon Landau, linux-rdma, Maor Gottlieb, Shay Drory

From: Mark Zhang <markzhang@nvidia.com>

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")
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/core/cm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index c903b74f46a4..add21a82c428 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -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]);
-- 
2.35.1


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

* Re: [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed
  2022-03-27  7:55 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
@ 2022-03-29  7:25   ` Leon Romanovsky
  0 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-03-29  7:25 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Aharon Landau, linux-rdma, Maor Gottlieb, Mark Zhang, Shay Drory

On Sun, Mar 27, 2022 at 10:55:46AM +0300, Leon Romanovsky wrote:
> From: Aharon Landau <aharonl@nvidia.com>
> 
> Don't remove MRs from the cache if need to delay the removal.
> 
> Fixes: b9358bdbc713 ("RDMA/mlx5: Fix locking in MR cache work queue")
> Signed-off-by: Aharon Landau <aharonl@nvidia.com>
> Reviewed-by: Shay Drory <shayd@nvidia.com>
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
>  drivers/infiniband/hw/mlx5/mr.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 8a87a2f074e4..4a01a0ad7c90 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -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.

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 8a87a2f074e4..fc5bc8ff1c57 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -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);
        }


> +			goto out;
> +		}
>  		queue_adjust_cache_locked(ent);
>  	}
>  out:
> -- 
> 2.35.1
> 

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

end of thread, other threads:[~2022-03-29  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-27  7:55 [PATCH rdma-rc 0/3] Fixes for v5.17 Leon Romanovsky
2022-03-27  7:55 ` [PATCH rdma-rc 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
2022-03-29  7:25   ` Leon Romanovsky
2022-03-27  7:55 ` [PATCH rdma-rc 2/3] RDMA/mlx5: Add a missing update of cache->last_add Leon Romanovsky
2022-03-27  7:55 ` [PATCH rdma-rc 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.