RE: [EXTERNAL] Re: [PATCH v4 0/3] UIO driver for low speed Hyper-V devices

Saurabh Singh Sengar
2023-08-21T07:36:40Z

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Saturday, August 12, 2023 4:45 PM
> To: Saurabh Sengar <ssengar@linux.microsoft.com>
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; wei.liu@kernel.org; Dexuan Cui
> <decui@microsoft.com>; Michael Kelley (LINUX) <mikelley@microsoft.com>;
> corbet@lwn.net; linux-kernel@vger.kernel.org; linux-hyperv@vger.kernel.org;
> linux-doc@vger.kernel.org
> Subject: [EXTERNAL] Re: [PATCH v4 0/3] UIO driver for low speed Hyper-V
> devices
>
> On Fri, Aug 04, 2023 at 12:09:53AM -0700, Saurabh Sengar wrote:
> > Hyper-V is adding multiple low speed "speciality" synthetic devices.
> > Instead of writing a new kernel-level VMBus driver for each device,
> > make the devices accessible to user space through a UIO-based
> > hv_vmbus_client driver. Each device can then be supported by a user
> > space driver. This approach optimizes the development process and
> > provides flexibility to user space applications to control the key
> > interactions with the VMBus ring buffer.
>
> Why is it faster to write userspace drivers here? Where are those new drivers,
> and why can't they be proper kernel drivers? Are all hyper-v drivers going to
> move to userspace now?

Hi Greg,

You are correct; it isn't faster. However, the developers working on these userspace
drivers can concentrate entirely on the business logic of these devices. The more
intricate aspects of the kernel, such as interrupt management and host communication,
can be encapsulated within the uio driver.

The quantity of Hyper-V devices is substantial, and their numbers are consistently
increasing. Presently, all of these drivers are in a development/planning phase and
rely significantly on the acceptance of this UIO driver as a prerequisite.

Not all hyper-v drivers will move to userspace, but many a new slow Hyperv-V
devices will use this framework and will avoid introducing a new kernel driver. We
will also plan to remove some of the existing drivers like kvp/vss.

>
> > The new synthetic devices are low speed devices that don't support
> > VMBus monitor bits, and so they must use vmbus_setevent() to notify
> > the host of ring buffer updates. The new driver provides this
> > functionality along with a configurable ring buffer size.
> >
> > Moreover, this series of patches incorporates an update to the fcopy
> > application, enabling it to seamlessly utilize the new interface. The
> > older fcopy driver and application will be phased out gradually.
> > Development of other similar userspace drivers is still underway.
> >
> > Moreover, this patch series adds a new implementation of the fcopy
> > application that uses the new UIO driver. The older fcopy driver and
> > application will be phased out gradually. Development of other similar
> > userspace drivers is still underway.
>
> You are adding a new user api with the "ring buffer" size api, which is odd for
> normal UIO drivers as that's not something that UIO was designed for.
>
> Why not just make you own generic type uiofs type kernel api if you really
> want to do all of this type of thing in userspace instead of in the kernel?

Could you please elaborate more on this suggestion. I couldn't understand it
completely.

>
> And finally, if this is going to replace the fcopy driver, then it should be part of
> this series as well, removing it to show that you really mean it when you say it
> will be deleted, otherwise we all know that will never happen.

I was hesitant about disrupting the backward compatibility, but I suppose I could
rename the new fcopy daemon to match the old one.

If this series has no other concern, I'll eliminate the current "fcopy" userspace
daemon and driver in the next version.

>
> thanks,
>
> greg k-h