[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240826131635.GJ3773488@nvidia.com>
Date: Mon, 26 Aug 2024 10:16:35 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Junxian Huang <huangjunxian6@...ilicon.com>
Cc: leon@...nel.org, linux-rdma@...r.kernel.org, linuxarm@...wei.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 for-next 1/3] RDMA/core: Provide
rdma_user_mmap_disassociate() to disassociate mmap pages
On Mon, Aug 26, 2024 at 09:12:33PM +0800, Junxian Huang wrote:
> diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
> index 821d93c8f712..05b589aad5ef 100644
> --- a/drivers/infiniband/core/uverbs.h
> +++ b/drivers/infiniband/core/uverbs.h
> @@ -160,6 +160,9 @@ struct ib_uverbs_file {
> struct page *disassociate_page;
>
> struct xarray idr;
> +
> + struct mutex disassociation_lock;
> + bool disassociated;
> };
>
> struct ib_uverbs_event {
> diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
> index 6b4d5a660a2f..6503f9a23211 100644
> --- a/drivers/infiniband/core/uverbs_main.c
> +++ b/drivers/infiniband/core/uverbs_main.c
> @@ -722,12 +722,12 @@ static void rdma_umap_open(struct vm_area_struct *vma)
> return;
>
> /* We are racing with disassociation */
> - if (!down_read_trylock(&ufile->hw_destroy_rwsem))
> + if (!mutex_trylock(&ufile->disassociation_lock))
> goto out_zap;
Nonon, don't touch this stuff! It is fine as is
The extra lock should be in the mmap zap functions only
Jason
Powered by blists - more mailing lists