* vsock support for communication between guests @ 2025-10-10 13:00 Robert Hoo 2025-11-06 14:32 ` Stefano Garzarella 0 siblings, 1 reply; 7+ messages in thread From: Robert Hoo @ 2025-10-10 13:00 UTC (permalink / raw) To: qemu-devel Hi, Does vsock support communication between guests? From man page, and my experiment, seems it doesn't. But why not? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-10-10 13:00 vsock support for communication between guests Robert Hoo @ 2025-11-06 14:32 ` Stefano Garzarella 2025-11-09 13:13 ` Robert Hoo 0 siblings, 1 reply; 7+ messages in thread From: Stefano Garzarella @ 2025-11-06 14:32 UTC (permalink / raw) To: Robert Hoo; +Cc: qemu-devel On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: >Hi, > >Does vsock support communication between guests? >From man page, and my experiment, seems it doesn't. >But why not? > It depends, vhost-user vsock device, supports it. See https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication The vhost-vsock in-kernel device doesn't support it. The main problem is that vsock is designed for host<->guest communication, so implementing a guest<->guest communication is possible, but requires more configuration (e.g. some kind of firewall, etc.) and also an extension to the address (see the required `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). The easy way to do that with vhost-vsock, is to use socat in the host to concatenate 2 VMs (some examples here: https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) Cheers, Stefano ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-11-06 14:32 ` Stefano Garzarella @ 2025-11-09 13:13 ` Robert Hoo 2025-11-10 11:10 ` Stefano Garzarella 2025-11-10 16:20 ` Bobby Eshleman 0 siblings, 2 replies; 7+ messages in thread From: Robert Hoo @ 2025-11-09 13:13 UTC (permalink / raw) To: Stefano Garzarella; +Cc: qemu-devel On 11/6/2025 10:32 PM, Stefano Garzarella wrote: > On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: >> Hi, >> >> Does vsock support communication between guests? >> From man page, and my experiment, seems it doesn't. >> But why not? >> > > It depends, vhost-user vsock device, supports it. > See > https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication > > The vhost-vsock in-kernel device doesn't support it. > > The main problem is that vsock is designed for host<->guest communication, so > implementing a guest<->guest communication is possible, but requires more > configuration (e.g. some kind of firewall, etc.) and also an extension to the > address (see the required > `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). > > The easy way to do that with vhost-vsock, is to use socat in the host to > concatenate 2 VMs (some examples here: > https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) > > Cheers, > Stefano > Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication requirement. I'll read the doc carefully later. BTW, I also found your vsock-bridge (https://github.com/stefano-garzarella/vsock-bridge); but seems its last commit was 5 yrs ago. It's not recommended, is it? ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-11-09 13:13 ` Robert Hoo @ 2025-11-10 11:10 ` Stefano Garzarella 2025-11-15 10:58 ` Robert Hoo 2025-11-10 16:20 ` Bobby Eshleman 1 sibling, 1 reply; 7+ messages in thread From: Stefano Garzarella @ 2025-11-10 11:10 UTC (permalink / raw) To: Robert Hoo; +Cc: qemu-devel On Sun, 9 Nov 2025 at 14:13, Robert Hoo <robert.hoo.linux@gmail.com> wrote: > > On 11/6/2025 10:32 PM, Stefano Garzarella wrote: > > On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: > >> Hi, > >> > >> Does vsock support communication between guests? > >> From man page, and my experiment, seems it doesn't. > >> But why not? > >> > > > > It depends, vhost-user vsock device, supports it. > > See > > https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication > > > > The vhost-vsock in-kernel device doesn't support it. > > > > The main problem is that vsock is designed for host<->guest communication, so > > implementing a guest<->guest communication is possible, but requires more > > configuration (e.g. some kind of firewall, etc.) and also an extension to the > > address (see the required > > `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). > > > > The easy way to do that with vhost-vsock, is to use socat in the host to > > concatenate 2 VMs (some examples here: > > https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) > > > > Cheers, > > Stefano > > > Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication > requirement. I'll read the doc carefully later. > > BTW, I also found your vsock-bridge > (https://github.com/stefano-garzarella/vsock-bridge); but seems its last commit > was 5 yrs ago. It's not recommended, is it? > Oh, that was just a little exercise I did to learn Rust at the time, so I'd say no, it's not recommended. BTW `socat` supports a similar use case, so related to the example in the vsock-bridge's README, you can do the following: host$ socat VSOCK-LISTEN:5201 VSOCK-CONNECT:4:5201 vm_cid3$ iperf --vsock -s vm_cid4$ iperf --vsock -c 2 But yeah, it's not 2 ways like vsock-bridge (i.e. `vm_cid3` can't connect to `vm_cid4`). Cheers, Stefano ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-11-10 11:10 ` Stefano Garzarella @ 2025-11-15 10:58 ` Robert Hoo 0 siblings, 0 replies; 7+ messages in thread From: Robert Hoo @ 2025-11-15 10:58 UTC (permalink / raw) To: Stefano Garzarella; +Cc: qemu-devel On 11/10/2025 7:10 PM, Stefano Garzarella wrote: > On Sun, 9 Nov 2025 at 14:13, Robert Hoo <robert.hoo.linux@gmail.com> wrote: >> >> On 11/6/2025 10:32 PM, Stefano Garzarella wrote: >>> On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: >>>> Hi, >>>> >>>> Does vsock support communication between guests? >>>> From man page, and my experiment, seems it doesn't. >>>> But why not? >>>> >>> >>> It depends, vhost-user vsock device, supports it. >>> See >>> https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication >>> >>> The vhost-vsock in-kernel device doesn't support it. >>> >>> The main problem is that vsock is designed for host<->guest communication, so >>> implementing a guest<->guest communication is possible, but requires more >>> configuration (e.g. some kind of firewall, etc.) and also an extension to the >>> address (see the required >>> `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). >>> >>> The easy way to do that with vhost-vsock, is to use socat in the host to >>> concatenate 2 VMs (some examples here: >>> https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) >>> >>> Cheers, >>> Stefano >>> >> Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication >> requirement. I'll read the doc carefully later. >> >> BTW, I also found your vsock-bridge >> (https://github.com/stefano-garzarella/vsock-bridge); but seems its last commit >> was 5 yrs ago. It's not recommended, is it? >> > > Oh, that was just a little exercise I did to learn Rust at the time, > so I'd say no, it's not recommended. > BTW `socat` supports a similar use case, so related to the example in > the vsock-bridge's README, you can do the following: > > host$ socat VSOCK-LISTEN:5201 VSOCK-CONNECT:4:5201 > vm_cid3$ iperf --vsock -s > vm_cid4$ iperf --vsock -c 2 > > But yeah, it's not 2 ways like vsock-bridge (i.e. `vm_cid3` can't > connect to `vm_cid4`). > > Cheers, > Stefano > Thanks Stefano. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-11-09 13:13 ` Robert Hoo 2025-11-10 11:10 ` Stefano Garzarella @ 2025-11-10 16:20 ` Bobby Eshleman 2025-11-15 11:13 ` Robert Hoo 1 sibling, 1 reply; 7+ messages in thread From: Bobby Eshleman @ 2025-11-10 16:20 UTC (permalink / raw) To: Robert Hoo; +Cc: Stefano Garzarella, qemu-devel On Sun, Nov 09, 2025 at 09:13:13PM +0800, Robert Hoo wrote: > On 11/6/2025 10:32 PM, Stefano Garzarella wrote: > > On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: > > > Hi, > > > > > > Does vsock support communication between guests? > > > From man page, and my experiment, seems it doesn't. > > > But why not? > > > > > > > It depends, vhost-user vsock device, supports it. > > See https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication > > > > The vhost-vsock in-kernel device doesn't support it. > > > > The main problem is that vsock is designed for host<->guest > > communication, so implementing a guest<->guest communication is > > possible, but requires more configuration (e.g. some kind of firewall, > > etc.) and also an extension to the address (see the required > > `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). > > > > The easy way to do that with vhost-vsock, is to use socat in the host to > > concatenate 2 VMs (some examples here: > > https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) > > > > Cheers, > > Stefano > > > Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication > requirement. I'll read the doc carefully later. > Though not as convenient as socat, VSOCK also supports sockmap which can do this in-kernel (bpf), there are a few test cases for this in selftests/bpf. Best, Bobby ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: vsock support for communication between guests 2025-11-10 16:20 ` Bobby Eshleman @ 2025-11-15 11:13 ` Robert Hoo 0 siblings, 0 replies; 7+ messages in thread From: Robert Hoo @ 2025-11-15 11:13 UTC (permalink / raw) To: Bobby Eshleman; +Cc: Stefano Garzarella, qemu-devel On 11/11/2025 12:20 AM, Bobby Eshleman wrote: > On Sun, Nov 09, 2025 at 09:13:13PM +0800, Robert Hoo wrote: >> On 11/6/2025 10:32 PM, Stefano Garzarella wrote: >>> On Fri, Oct 10, 2025 at 09:00:21PM +0800, Robert Hoo wrote: >>>> Hi, >>>> >>>> Does vsock support communication between guests? >>>> From man page, and my experiment, seems it doesn't. >>>> But why not? >>>> >>> >>> It depends, vhost-user vsock device, supports it. >>> See https://github.com/rust-vmm/vhost-device/tree/main/vhost-device-vsock#sibling-vm-communication >>> >>> The vhost-vsock in-kernel device doesn't support it. >>> >>> The main problem is that vsock is designed for host<->guest >>> communication, so implementing a guest<->guest communication is >>> possible, but requires more configuration (e.g. some kind of firewall, >>> etc.) and also an extension to the address (see the required >>> `.svm_flags = VMADDR_FLAG_TO_HOST` in the link). >>> >>> The easy way to do that with vhost-vsock, is to use socat in the host to >>> concatenate 2 VMs (some examples here: >>> https://stefano-garzarella.github.io/posts/2021-01-22-socat-vsock/) >>> >>> Cheers, >>> Stefano >>> >> Nice, thanks Stefano. It sounds ideal for my VM <--> VM communication >> requirement. I'll read the doc carefully later. >> > > Though not as convenient as socat, VSOCK also supports sockmap which can > do this in-kernel (bpf), there are a few test cases for this in > selftests/bpf. > > Best, > Bobby Nice to know this, thanks Bobby. It a good idea. I'll look into the selftests for reference. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-11-15 11:13 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-10 13:00 vsock support for communication between guests Robert Hoo 2025-11-06 14:32 ` Stefano Garzarella 2025-11-09 13:13 ` Robert Hoo 2025-11-10 11:10 ` Stefano Garzarella 2025-11-15 10:58 ` Robert Hoo 2025-11-10 16:20 ` Bobby Eshleman 2025-11-15 11:13 ` Robert Hoo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).