Skip to content

Commit a53e215

Browse files
mosheshemesh2jgunthorpe
authored andcommitted
RDMA/mlx5: Fix mkey cache WQ flush
The cited patch tries to ensure no pending works on the mkey cache workqueue by disabling adding new works and call flush_workqueue(). But this workqueue also has delayed works which might still be pending the delay time to be queued. Add cancel_delayed_work() for the delayed works which waits to be queued and then the flush_workqueue() will flush all works which are already queued and running. Fixes: 374012b ("RDMA/mlx5: Fix mkey cache possible deadlock on cleanup") Link: https://lore.kernel.org/r/b8722f14e7ed81452f791764a26d2ed4cfa11478.1698256179.git.leon@kernel.org Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent 162e348 commit a53e215

File tree

1 file changed

+2
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+2
-0
lines changed

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,11 +1000,13 @@ void mlx5_mkey_cache_cleanup(struct mlx5_ib_dev *dev)
10001000
return;
10011001

10021002
mutex_lock(&dev->cache.rb_lock);
1003+
cancel_delayed_work(&dev->cache.remove_ent_dwork);
10031004
for (node = rb_first(root); node; node = rb_next(node)) {
10041005
ent = rb_entry(node, struct mlx5_cache_ent, node);
10051006
spin_lock_irq(&ent->mkeys_queue.lock);
10061007
ent->disabled = true;
10071008
spin_unlock_irq(&ent->mkeys_queue.lock);
1009+
cancel_delayed_work(&ent->dwork);
10081010
}
10091011
mutex_unlock(&dev->cache.rb_lock);
10101012

0 commit comments

Comments
 (0)