On Sat, Feb 17, 2024 at 10:03:36AM -0800, Saurabh Sengar wrote:
> Query the ring buffer size from pre defined table per device.
> Keep the size as is if the device doesn't have any preferred
> ring size.

What is the "as is" size?

> 
> Signed-off-by: Saurabh Sengar <ssen...@linux.microsoft.com>
> ---
>  drivers/uio/uio_hv_generic.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c
> index 20d9762331bd..4bda6b52e49e 100644
> --- a/drivers/uio/uio_hv_generic.c
> +++ b/drivers/uio/uio_hv_generic.c
> @@ -238,6 +238,7 @@ hv_uio_probe(struct hv_device *dev,
>       struct hv_uio_private_data *pdata;
>       void *ring_buffer;
>       int ret;
> +     size_t ring_size = hv_dev_ring_size(channel);
>  
>       /* Communicating with host has to be via shared memory not hypercall */
>       if (!channel->offermsg.monitor_allocated) {
> @@ -245,12 +246,14 @@ hv_uio_probe(struct hv_device *dev,
>               return -ENOTSUPP;
>       }
>  
> +     if (!ring_size)
> +             ring_size = HV_RING_SIZE * PAGE_SIZE;

Why the magic * PAGE_SIZE here?

Where is it documented that ring_size is in pages?

And what happens when PAGE_SIZE is changed?  Why are you relying on that
arbritrary value to dictate your buffer sizes to a device that has
no relationship with PAGE_SIZE?

Yes, I know you are copying what was there today, but you have the
chance to rethink and most importantly, DOCUMENT this decision properly
now.

thanks,

greg k-h

Reply via email to