crosvm: breaking change to vhost-user implementation

49 views
Skip to first unread message

Frederick Mayle

unread,
Mar 14, 2024, 4:27:24 PMMar 14
to crosvm-dev, Alyssa Ross, Gurchetan Singh, Jason Macnak
If you use crosvm with a non-crosvm vhost-user device OR if you use one of crosvm's vhost-user devices with another VMM, you might need to adjust the non-crosvm code to match https://crrev.com/c/5369109.

crosvm's vhost-user protocol implementation has defined some message types which aren't in the spec. The IDs we chose are now in conflict with new message types that were added to the spec in the meanwhile. In https://crrev.com/c/5369109, I'm going to change all the non-standard IDs so that we are closer to being compatible with the spec.

I'm pretty confident no one is using GET_SHARED_MEMORY_REGIONS (used by crosvm's defunct vvu implementation) and that I know everyone who is using SLEEP/WAKE/SNAPSHOT/RESTORE.

I know less about use the following message types

        /// Indicates a request to map a fd into a shared memory region.
        SHMEM_MAP = 6,
        /// Indicates a request to unmap part of a shared memory region.
        SHMEM_UNMAP = 7,
        /// Virtio-fs draft: map file content into the window.
        FS_MAP = 8,
        /// Virtio-fs draft: unmap file content from the window.
        FS_UNMAP = 9,
        /// Virtio-fs draft: sync file content.
        FS_SYNC = 10,
        /// Virtio-fs draft: perform a read/write from an fd directly to GPA.
        FS_IO = 11,
        /// Indicates a request to map GPU memory into a shared memory region.
        GPU_MAP = 12,
        /// Indicates a request to map external memory into a shared memory region.
        EXTERNAL_MAP = 13,

Let me know if you are concerned. Thanks.

Alyssa Ross

unread,
Mar 16, 2024, 5:27:21 PMMar 16
to Frederick Mayle, crosvm-dev, Gurchetan Singh, Jason Macnak
Frederick Mayle <fma...@google.com> writes:

> If you use crosvm with a non-crosvm vhost-user device OR if you use one of
> crosvm's vhost-user devices with another VMM, you might need to adjust the
> non-crosvm code to match https://crrev.com/c/5369109.
>
> crosvm's vhost-user protocol implementation has defined some message types
> which aren't in the spec
> <https://qemu-project.gitlab.io/qemu/interop/vhost-user.html>. The IDs we
> chose are now in conflict with new message types that were added to the
> spec in the meanwhile. In https://crrev.com/c/5369109, I'm going to change
> all the non-standard IDs so that we are closer to being compatible with the
> spec.
>
> I'm pretty confident no one is using GET_SHARED_MEMORY_REGIONS (used by
> crosvm's defunct vvu implementation) and that I know everyone who is using
> SLEEP/WAKE/SNAPSHOT/RESTORE.

I'm using GET_SHARED_MEMORY_REGIONS!
https://spectrum-os.org/git/spectrum/tree/pkgs/cloud-hypervisor/0002-virtio-devices-add-a-GPU-device.patch?id=04b5e6c27190cb77ece33503715357473b445531#n451

But fixing the IDs is a great idea, and I'm happy to update my code.
Thanks for the heads up!
signature.asc

Frederick Mayle

unread,
Mar 19, 2024, 1:35:47 PMMar 19
to Alyssa Ross, crosvm-dev, Gurchetan Singh, Jason Macnak
Good to know, thanks!

Minor update: The FS_* ones were unreachable in crosvm, so all the supporting code has been deleted. FWIW, they also exist in the rust_vmm project with the same IDs, not sure if they are actually used there though.
Reply all
Reply to author
Forward
0 new messages