Message ID | 482a78c54acbcfa1742a0e06a452546428900ffa.1675328463.git.leon@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | Two small fixes to MR cache series | expand |
On Thu, Feb 02, 2023 at 11:03:06AM +0200, Leon Romanovsky wrote: > From: Leon Romanovsky <leonro@nvidia.com> > > Block MR cache debugfs creation while in switchdev mode and add missing > debugfs cleanup in error path. Why does switchdev have anything to do with this? Jason
On Thu, Feb 02, 2023 at 09:56:51AM -0400, Jason Gunthorpe wrote: > On Thu, Feb 02, 2023 at 11:03:06AM +0200, Leon Romanovsky wrote: > > From: Leon Romanovsky <leonro@nvidia.com> > > > > Block MR cache debugfs creation while in switchdev mode and add missing > > debugfs cleanup in error path. > > Why does switchdev have anything to do with this? > Because we always had the following code in cleanup: 697 static void mlx5_mkey_cache_debugfs_cleanup(struct mlx5_ib_dev *dev) 698 { 699 if (!mlx5_debugfs_root || dev->is_rep) 700 return; 701 MR cache shouldn't be used at all for IB representors, and more comprehensive patch will take more work than this simple solution. Thanks > Jason
On Thu, Feb 02, 2023 at 04:05:18PM +0200, Leon Romanovsky wrote: > On Thu, Feb 02, 2023 at 09:56:51AM -0400, Jason Gunthorpe wrote: > > On Thu, Feb 02, 2023 at 11:03:06AM +0200, Leon Romanovsky wrote: > > > From: Leon Romanovsky <leonro@nvidia.com> > > > > > > Block MR cache debugfs creation while in switchdev mode and add missing > > > debugfs cleanup in error path. > > > > Why does switchdev have anything to do with this? > > > > Because we always had the following code in cleanup: > 697 static void mlx5_mkey_cache_debugfs_cleanup(struct mlx5_ib_dev *dev) > 698 { > 699 if (!mlx5_debugfs_root || dev->is_rep) > 700 return; > 701 > > MR cache shouldn't be used at all for IB representors, and more > comprehensive patch will take more work than this simple solution. That make sense, the commit message should explain it.. Jason
On Thu, Feb 02, 2023 at 11:07:54AM -0400, Jason Gunthorpe wrote: > On Thu, Feb 02, 2023 at 04:05:18PM +0200, Leon Romanovsky wrote: > > On Thu, Feb 02, 2023 at 09:56:51AM -0400, Jason Gunthorpe wrote: > > > On Thu, Feb 02, 2023 at 11:03:06AM +0200, Leon Romanovsky wrote: > > > > From: Leon Romanovsky <leonro@nvidia.com> > > > > > > > > Block MR cache debugfs creation while in switchdev mode and add missing > > > > debugfs cleanup in error path. > > > > > > Why does switchdev have anything to do with this? > > > > > > > Because we always had the following code in cleanup: > > 697 static void mlx5_mkey_cache_debugfs_cleanup(struct mlx5_ib_dev *dev) > > 698 { > > 699 if (!mlx5_debugfs_root || dev->is_rep) > > 700 return; > > 701 > > > > MR cache shouldn't be used at all for IB representors, and more > > comprehensive patch will take more work than this simple solution. > > That make sense, the commit message should explain it.. OK, I added the following to the commit message. RDMA/mlx5: Fix MR cache debugfs error in IB representors mode Block MR cache debugfs creation for IB representor flow as MR cache shouldn't be used at all in that mode. As part of this change, add missing debugfs cleanup in error path too. RDMA/mlx5: Fix MR cache debugfs error in IB representors mode Block MR cache debugfs creation for IB representor flow as MR cache shouldn't be used at all in that mode. As part of this change, add missing debugfs cleanup in error path too. Thanks > > Jason
diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c index 3a9a787184fc..3f410eef58e4 100644 --- a/drivers/infiniband/hw/mlx5/mr.c +++ b/drivers/infiniband/hw/mlx5/mr.c @@ -848,6 +848,9 @@ static void mlx5_mkey_cache_debugfs_add_ent(struct mlx5_ib_dev *dev, int order = order_base_2(ent->rb_key.ndescs); struct dentry *dir; + if (!mlx5_debugfs_root || dev->is_rep) + return; + if (ent->rb_key.access_mode == MLX5_MKC_ACCESS_MODE_KSM) order = MLX5_IMR_KSM_CACHE_ENTRY + 2; @@ -1006,6 +1009,7 @@ int mlx5_mkey_cache_init(struct mlx5_ib_dev *dev) err: mutex_unlock(&cache->rb_lock); + mlx5_mkey_cache_debugfs_cleanup(dev); mlx5_ib_warn(dev, "failed to create mkey cache entry\n"); return ret; }