qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: questions regarding vsock


From: Robin Meinzer
Subject: Re: Re: questions regarding vsock
Date: Tue, 22 Sep 2020 22:40:52 +0200

 
Gesendet: Donnerstag, 17. September 2020 um 13:20 Uhr
Von: "Stefan Hajnoczi" <stefanha@redhat.com>
An: "Robin Meinzer" <robmeinzer11@gmx.de>
Cc: sgarzare@redhat.com
Betreff: Re: questions regarding vsock
On Thu, Sep 17, 2020 at 12:25:02AM +0200, Robin Meinzer wrote:

Hi,
I have CCed Stefano Garzarella, who co-maintains virtio-vsock with me.
Please send technical questions to qemu-devel@nongnu.org in the future
and CC us. That way others can participate in the discussion and it's
archived in case someone else has the same question in the future.

> <div>- If I want to run multiple qemu instances with vsock in each of them, -device ... guest-cid=CID has to be different for every VM. I don&#39;t want to run VMs always manually, so can I assign a random or basically a free-to-take CID?<br/>
> This is what I would expect: -device ... guest-cid=ANY_CID<br/>

Userspace needs to allocate CIDs. The kernel does not automatically
allocate them. With Ethernet you would need to assign each guest a
unique MAC address, for example.

Is there some unique value associated with your guests that you can use?

> - I managed to send data from host to vm and vice versa via SOCK_STREAM. Although whenever I want to use SOCK_DGRAM, I get an error message with &quot;no such device&quot;. Do you maybe know how to fix this to get a UDP-like connection?<br/>

virtio-vsock currently only supports SOCK_STREAM.

> - I see that from factory vsock is only read-write to root and noone else, so I have to run the VM as root. How does it look in practice, is it just for me or does any distro ship with /dev/vsock set to root only, because it feels like I shouldn&#39;t necessarily run a VM with root privileges.

A privileged process can open /dev/vhost-vsock and spawn an unprivileged
QEMU process with -device vhost-vsock-pci,guest-cid=CID,vhostfd=FD.

Stefan


--
I added Stefano Garzarella and qemu-devel as you asked. I wonder if you don't support SOCK_DGRAM but only SOCK_STREAM, why having code for it then? There are functions like vsock_dgram_connect and a proto_ops struct specifically for SOCK_DGRAM, but any attempt to create a socket for it ends with -ENODEV (transport_dgram is NULL, I guess it's on purpose because you don't support it as you said).

Another thing, could you please tell me what I have to set in the kernel .config to have vsockets working out of the box, for now lsmod doesn't show me vmw_vsock_transport_common or vsock or vsock_host existence in the form of a autoloaded module at all.

Greetings

reply via email to

[Prev in Thread] Current Thread [Next in Thread]