lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240219094023.GB32526@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Mon, 19 Feb 2024 01:40:23 -0800
From: Saurabh Singh Sengar <ssengar@...ux.microsoft.com>
To: Greg KH <gregkh@...uxfoundation.org>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
	decui@...rosoft.com, linux-hyperv@...r.kernel.org,
	linux-kernel@...r.kernel.org, ssengar@...rosoft.com
Subject: Re: [PATCH 2/6] uio_hv_generic: Query the ringbuffer size for device

On Mon, Feb 19, 2024 at 09:50:54AM +0100, Greg KH wrote:
> 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?

I will elaborate more here.

> 
> > 
> > Signed-off-by: Saurabh Sengar <ssengar@...ux.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.

I agree PAGE_SIZE is not accurate here and we should use HV_HYP_PAGE_SIZE.
This can be further improved by using VMBUS_RING_SIZE macro.

However, I propose addressing this improvement in a separate patch, given
the are significant changes already present in this series.

- Saurabh


> 
> thanks,
> 
> greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ