diff options
author | Moshe Shemesh <moshe@nvidia.com> | 2023-10-25 20:49:59 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2023-10-31 10:57:49 -0300 |
commit | a53e215f90079f617360439b1b6284820731e34c (patch) | |
tree | 6076b4962e4f05b1210746ba68230703e529a306 | |
parent | 162e3480246ef69386d4647d2320d86741bf08a2 (diff) | |
download | linux-a53e215f90079f617360439b1b6284820731e34c.tar.gz linux-a53e215f90079f617360439b1b6284820731e34c.tar.bz2 linux-a53e215f90079f617360439b1b6284820731e34c.zip |
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: 374012b00457 ("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>
-rw-r--r-- | drivers/infiniband/hw/mlx5/mr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 1d6c54a53df6..18e459b55746 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -1000,11 +1000,13 @@ void mlx5_mkey_cache_cleanup(struct mlx5_ib_dev *dev) return; mutex_lock(&dev->cache.rb_lock); + cancel_delayed_work(&dev->cache.remove_ent_dwork); for (node = rb_first(root); node; node = rb_next(node)) { ent = rb_entry(node, struct mlx5_cache_ent, node); spin_lock_irq(&ent->mkeys_queue.lock); ent->disabled = true; spin_unlock_irq(&ent->mkeys_queue.lock); + cancel_delayed_work(&ent->dwork); } mutex_unlock(&dev->cache.rb_lock); |