Re: [PATCH v7] virtio-vsock: Add support for multi devices

Stefano Garzarella <[email protected]>
Newsgroups dev.linux.lists.virtio-comment
Message-ID <CAGxU2F6LtwfO_AgTxk+wEeqv1vKCmMGJNzyu08ttGYUfad3mGA@mail.gmail.com>
On Fri, 13 Jun 2025 at 06:57, Xuewei Niu <[email protected]> wrote:
>
> > On Sat, Apr 12, 2025 at 10:39 PM Xuewei Niu <[email protected]> wrote:
> > >
> > > This patch brings a new feature, called "multi devices", to the virtio
> > > vsock. It introduces a "VIRTIO_VSOCK_F_MULTI_DEVICES" feature bit, and a
> > > "device_order" field to the config for the virtio vsock.
> > >
> > > == Motivition ==
> > >
> > > Vsock is a lightweight and widely used data exchange mechanism between host
> > > and guest. Currently, the virtio-vsock only supports one device, resulting
> > > in the inability to enable more than one backend.
> >
> > I wonder which part of the spec forbids more than one device.
>
> No. The spec, however, is designed for a single device, and lacks some
> specifications for multiple devices.
>
> For example, we should have a mechanism to select a device from all to
> communicate with a peer.
>
> This patch introduces a new feature bit "VIRTIO_VSOCK_F_MULTI_DEVICES", and
> involves some modifications to the config space, device & driver norms.

Maybe we should think a better name to avoid confusion, like "F_DEVICE_ORDER".
I'm not good at name, so if others are better suggestion, they are welcome.

>
> > > For instance, two devices
> > > are required: one to transfer data to the VMM via virtio-vsock, and another
> > > to a user process via vhost-user-vsock.
> > >
> > > Apart from that, a side gain is that theoretically the performance might be
> > > improved since each device has its own queue. But it varies depending on
> > > the implementation.
> >
> > It could implement multiqueue anyhow.
> >
> > Thanks
>
> Yes, indeed. As we discussed before, I marked this as a side gain. And
> @Stefano said that the community has a plan to implement multiqueue for
> vsock.

I'm not sure there is a plan, but yeah, we should do it some day.
As I mention in the previous email, I'd remove any reference to performance.

I'd just talk about a mechanism to select a default out device, when
the source socket is not bound to any address, like a default gateway.

Thanks,
Stefano

> The foundational goal of this patch is to enable vsock to support
> multiple backends.
>
> Thanks,
> Xuewei
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.