Re: [PATCH rdma-rc] RDMA/mlx5: Fix dereg mr flow for kernel MRs

From: Jason Gunthorpe
Date: Mon Jan 03 2022 - 19:08:17 EST


On Mon, Jan 03, 2022 at 08:26:24PM +0200, Leon Romanovsky wrote:

> The proposals are:
> 1. Return back to v1, which had dummy umem, so so DM memory regions will
> behave as regular user created verbs object.
> 2. Add extra flag to is_user/is_kernel for mlx5 mr struct and update all
> paths to rely on that flag.
> 3. Create separate dereg MR function that will treat DM differently.

It is not DM that is the problem, ti is that user and kernel has been
mixed together in this mess despite being completely different.

I've been slowly disentangling them and the series you just sent 'MR
cache enhancment' removes the last blocker from completely giving
kernel MRs their own struct.

So, the solution here is to move in the direction of making the kernel
MRs different. There is only one place that destroys a kernel MR, just
have it call a special 'destroy kernel MR' function that doesn't touch
any umem stuff at all. Remove the kernel-only parts entirely from the
current function.

After Aharon's series we can give them different types. Notice the
union is already completely disjoint except for the little bit
tracking the cache which evaporates once the cache only stores the
mkey # and not the struct memory.

Jason