diff mbox series

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

Message ID 73c3fef51ee2bb50ae240306472d9562ba05916f.1648366974.git.leonro@nvidia.com (mailing list archive)
State Superseded
Headers show
Series Fixes for v5.17 | expand

Commit Message

Leon Romanovsky March 27, 2022, 7:55 a.m. UTC
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(-)

Comments

Leon Romanovsky March 29, 2022, 7:25 a.m. UTC | #1
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
>
diff mbox series

Patch

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: