Re: [PATCH rdma-next 5/6] RDMA/mlx5: Change check for cacheable user mkeys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 25, 2024 at 09:38:24AM -0400, Jason Gunthorpe wrote:
> On Thu, Jan 25, 2024 at 08:52:57PM +0800, Junxian Huang wrote:
> > 
> > 
> > On 2024/1/25 20:30, Leon Romanovsky wrote:
> > > From: Or Har-Toov <ohartoov@xxxxxxxxxx>
> > > 
> > > In the dereg flow, UMEM is not a good enough indication whether an MR
> > > is from userspace since in mlx5_ib_rereg_user_mr there are some cases
> > > when a new MR is created and the UMEM of the old MR is set to NULL.
> > > Currently when mlx5_ib_dereg_mr is called on the old MR, UMEM is NULL
> > > but cache_ent can be different than NULL. So, the mkey will not be
> > > destroyed.
> > > Therefore checking if mkey is from user application and cacheable
> > > should be done by checking if rb_key or cache_ent exist and all other kind of
> > > mkeys should be destroyed.
> > > 
> > > Fixes: dd1b913fb0d0 ("RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow")
> > > Signed-off-by: Or Har-Toov <ohartoov@xxxxxxxxxx>
> > > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
> > > ---
> > >  drivers/infiniband/hw/mlx5/mr.c | 15 ++++++++-------
> > >  1 file changed, 8 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> > > index 12bca6ca4760..3c241898e064 100644
> > > --- a/drivers/infiniband/hw/mlx5/mr.c
> > > +++ b/drivers/infiniband/hw/mlx5/mr.c
> > > @@ -1857,6 +1857,11 @@ static int cache_ent_find_and_store(struct mlx5_ib_dev *dev,
> > >  	return ret;
> > >  }
> > >  
> > > +static bool is_cacheable_mkey(struct mlx5_ib_mkey mkey)
> > 
> > I think it's better using a pointer as the parameter instead of the struct itself.
> 
> Indeed, that looks like a typo

It is suboptimal to pass struct by value, because whole struct will be copied,
but it is not a mistake too.

Thanks

> 
> Thanks,
> Jason
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux