Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@nvidia.com>
Cc: Junxian Huang <huangjunxian6@hisilicon.com>,
	Or Har-Toov <ohartoov@nvidia.com>,
	Edward Srouji <edwards@nvidia.com>,
	linux-rdma@vger.kernel.org, Maor Gottlieb <maorg@nvidia.com>,
	Mark Zhang <markzhang@nvidia.com>,
	Michael Guralnik <michaelgur@nvidia.com>,
	Tamar Mashiah <tmashiah@nvidia.com>,
	Yishai Hadas <yishaih@nvidia.com>
Subject: Re: [PATCH rdma-next 5/6] RDMA/mlx5: Change check for cacheable user mkeys
Date: Fri, 26 Jan 2024 10:17:56 +0800	[thread overview]
Message-ID: <e550d100-9545-425e-b548-d6a588968b31@linux.dev> (raw)
In-Reply-To: <20240125200230.GD9841@unreal>

在 2024/1/26 4:02, Leon Romanovsky 写道:
> 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@nvidia.com>
>>>>
>>>> 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@nvidia.com>
>>>> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
>>>> ---
>>>>   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,

Agree. With a pointer, an address is passed. With the struct, the whole 
struct is copied and passed. The overhead of calling function is less 
with a pointer.

Zhu Yanjun

> but it is not a mistake too.
> 
> Thanks
> 
>>
>> Thanks,
>> Jason
>>


  reply	other threads:[~2024-01-26  2:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 12:30 [PATCH rdma-next 0/6] Collection of mlx5_ib fixes Leon Romanovsky
2024-01-25 12:30 ` [PATCH rdma-next 1/6] RDMA/mlx5: Fix fortify source warning while accessing Eth segment Leon Romanovsky
2024-01-25 12:30 ` [PATCH rdma-next 2/6] IB/mlx5: Don't expose debugfs entries for RRoCE general parameters if not supported Leon Romanovsky
2024-01-25 12:30 ` [PATCH rdma-next 3/6] RDMA/mlx5: Relax DEVX access upon modify commands Leon Romanovsky
2024-01-25 12:30 ` [PATCH rdma-next 4/6] RDMA/mlx5: Uncacheable mkey has neither rb_key or cache_ent Leon Romanovsky
2024-01-25 12:30 ` [PATCH rdma-next 5/6] RDMA/mlx5: Change check for cacheable user mkeys Leon Romanovsky
2024-01-25 12:52   ` Junxian Huang
2024-01-25 13:30     ` Zhu Yanjun
2024-01-26  1:47       ` Junxian Huang
2024-01-25 13:38     ` Jason Gunthorpe
2024-01-25 20:02       ` Leon Romanovsky
2024-01-26  2:17         ` Zhu Yanjun [this message]
2024-01-25 12:30 ` [PATCH rdma-next 6/6] RDMA/mlx5: Adding remote atomic access flag to updatable flags Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e550d100-9545-425e-b548-d6a588968b31@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=edwards@nvidia.com \
    --cc=huangjunxian6@hisilicon.com \
    --cc=jgg@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@nvidia.com \
    --cc=markzhang@nvidia.com \
    --cc=michaelgur@nvidia.com \
    --cc=ohartoov@nvidia.com \
    --cc=tmashiah@nvidia.com \
    --cc=yishaih@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox