[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5d93095a-06f4-53d8-e92b-3a21e7667975@hisilicon.com>
Date: Mon, 26 Aug 2024 21:21:24 +0800
From: Junxian Huang <huangjunxian6@...ilicon.com>
To: Jason Gunthorpe <jgg@...dia.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 2024/8/26 21:16, Jason Gunthorpe wrote:
> 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
Okay, I got it. Thanks
Junxian
Powered by blists - more mailing lists