[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZVnZBXtV5LYUWUHp@x130>
Date: Sun, 19 Nov 2023 01:44:37 -0800
From: Saeed Mahameed <saeed@...nel.org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org, Leon Romanovsky <leonro@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>, Jiri Pirko <jiri@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>
Subject: Re: [PATCH 5/5] misc: mlx5ctl: Add umem reg/unreg ioctl
On 18 Oct 11:30, Arnd Bergmann wrote:
>On Wed, Oct 18, 2023, at 10:19, Saeed Mahameed wrote:
>> From: Saeed Mahameed <saeedm@...dia.com>
>
>>
>> To do so this patch introduces two ioctls:
>>
>> MLX5CTL_IOCTL_UMEM_REG(va_address, size):
>> - calculate page fragments from the user provided virtual address
>> - pin the pages, and allocate a sg list
>> - dma map the sg list
>> - create a UMEM device object that points to the dma addresses
>> - add a driver umem object to an xarray data base for bookkeeping
>> - return UMEM ID to user so it can be used in subsequent rpcs
>>
>> MLX5CTL_IOCTL_UMEM_UNREG(umem_id):
>> - user provides a pre allocated umem ID
>> - unwinds the above
>>
>
[...]
>> +
>> + umem_id = mlx5ctl_umem_reg(mfd->umem_db, (unsigned
>> long)umem_reg.addr, umem_reg.len);
>
>umem_reg.addr seems to be a user space address, so I would
>suggest consistently passing it as a 'void __user *' instead
>of casting to (unsigned long) here. You can use u64_to_user_ptr()
>to handle the pointer conversion correctly across all
>architectures that way, and get better type checking.
>
Hi Arnd,
I handled all of your comments in V2 except this one, since here we use
the user address for arithmetic calculations only, so it is easier to
convert it to (unsigned long) early on ..
Powered by blists - more mailing lists