linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-rc v1 0/3] Fixes for v5.17
@ 2022-04-04  8:58 Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-04-04  8:58 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>

Changelog:
v1:
 * Fixed rebase error in patch #1
v0: https://lore.kernel.org/all/cover.1648366974.git.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 | 5 ++++-
 2 files changed, 5 insertions(+), 3 deletions(-)

-- 
2.35.1


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

* [PATCH rdma-rc v1 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed
  2022-04-04  8:58 [PATCH rdma-rc v1 0/3] Fixes for v5.17 Leon Romanovsky
@ 2022-04-04  8:58 ` Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 2/3] RDMA/mlx5: Add a missing update of cache->last_add Leon Romanovsky
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-04-04  8:58 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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 956f8e875daa..45b0680377ec 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -574,8 +574,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);
 	}
-- 
2.35.1


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

* [PATCH rdma-rc v1 2/3] RDMA/mlx5: Add a missing update of cache->last_add
  2022-04-04  8:58 [PATCH rdma-rc v1 0/3] Fixes for v5.17 Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
@ 2022-04-04  8:58 ` Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD Leon Romanovsky
  2022-04-04 13:39 ` [PATCH rdma-rc v1 0/3] Fixes for v5.17 Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-04-04  8:58 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 45b0680377ec..32ef67e9a6a7 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -627,6 +627,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 v1 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD
  2022-04-04  8:58 [PATCH rdma-rc v1 0/3] Fixes for v5.17 Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 1/3] RDMA/mlx5: Don't remove cache MRs when a delay is needed Leon Romanovsky
  2022-04-04  8:58 ` [PATCH rdma-rc v1 2/3] RDMA/mlx5: Add a missing update of cache->last_add Leon Romanovsky
@ 2022-04-04  8:58 ` Leon Romanovsky
  2022-04-04 13:39 ` [PATCH rdma-rc v1 0/3] Fixes for v5.17 Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Leon Romanovsky @ 2022-04-04  8:58 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 disconnectReq 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 35f0d5e7533d..1c107d6d03b9 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 v1 0/3] Fixes for v5.17
  2022-04-04  8:58 [PATCH rdma-rc v1 0/3] Fixes for v5.17 Leon Romanovsky
                   ` (2 preceding siblings ...)
  2022-04-04  8:58 ` [PATCH rdma-rc v1 3/3] IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD Leon Romanovsky
@ 2022-04-04 13:39 ` Jason Gunthorpe
  3 siblings, 0 replies; 5+ messages in thread
From: Jason Gunthorpe @ 2022-04-04 13:39 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Leon Romanovsky, Aharon Landau, linux-rdma, Maor Gottlieb,
	Mark Zhang, Shay Drory

On Mon, Apr 04, 2022 at 11:58:02AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
> 
> Changelog:
> v1:
>  * Fixed rebase error in patch #1
> v0: https://lore.kernel.org/all/cover.1648366974.git.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

Applied to for-rc, thanks

Jason

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

end of thread, other threads:[~2022-04-04 13:39 UTC | newest]

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).