OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-comment message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [virtio-comment] Seeking guidance for custom virtIO device


On Fri, Apr 10, 2020 at 12:09:22PM +0200, Stefano Garzarella wrote:
> Hi,
> 
> On Fri, Apr 10, 2020 at 09:36:58AM +0000, Eftime, Petre wrote:
> > Hi all,
> > 
> > I am looking for guidance on how to proceed with regards to either reserving a virtio device ID for a specific device for a particular usecase  or for formalizing a device type that could be potentially used by others.
> > 
> > We have developed a virtio device that acts as a transport for API calls between a guest userspace library and a backend server in the host system.
> > Our requirements are:
> > * multiple clients in the guest (multiple servers is not required)
> > * provide an in-order, reliable datagram transport mechanism
> > * datagram size should be either negotiable or large (16k-64k?)
> > * performance is not a big concern for our usecase
> 
> It looks really close to vsock.
> 
> > 
> > The reason why we used a special device and not something else is the following:
> > * vsock spec does not contain a datagram specification (eg. SOCK_DGRAM, SOCK_SEQPACKET) and the effort of updating the Linux driver and other implementations for this particular purpose  seemed relatively high. The path to approach this problem wasn't clear. Vsock today only works in SOCK_STREAM mode and this is not ideal: the receiver must implement additional state and buffer incoming data,  adding complexity and host resource usage.
> 
> AF_VSOCK itself supports SOCK_DGRAM, but virtio-vsock doesn't provide
> this feature. (vmci provides SOCK_DGRAM support)
> 
> The changes should not be too intrusive in the virtio-vsock specs and
> implementation, we already have the "type" field in the packet header
> to address this new feature.
> 
> We also have the credit-mechanism to provide in-order and reliable
> packets delivery.
> 
> Maybe the hardest part could be change something in the core to handle
> multiple transports that provide SOCK_DGRAM, for nested VMs.
> We already did for stream sockets, but we didn't handle the datagram
> socket for now.
> 
> I am not sure how convenient it is to have two very similar devices...
> 
> If you decide to give virtio-vsock a chance to get SOCK_DGRAM, I can try to
> give you a more complete list of changes to make. :-)

I although think this sounds exactly like adding SOCK_DGRAM support to
virtio-vsock.

The reason why the SOCK_DGRAM code was dropped from early virtio-vsock
patches is that the prototocol design didn't ensure reliable delivery
semantics.  At that time there were no real users for SOCK_DGRAM so it
was left as a feature to be added later.

The challenge with reusing the SOCK_STREAM credit mechanism for
SOCK_DGRAM is that datagrams are connectionless.  The credit mechanism
consists per-connection state.  Maybe it can be extended to cover
SOCK_DGRAM too.

I would urge you to add SOCK_DGRAM to virtio-vsock instead of trying to
create another device that does basically what is within the scope of
virtio-vsock.  It took quite a bit of time and effort to get AF_VSOCK
support into various software components, and doing that again for
another device is more effort than one would think.

If you don't want to modify the Linux guest driver, then let's just
discuss the device spec and protocol.  Someone else could make the Linux
driver changes.

Stefan

Attachment: signature.asc
Description: PGP signature



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]