commit | 4ce4bbc2289ebc5422d5eae9226d3e765206d9a0 | [log] [tgz] |
---|---|---|
author | Daniel Verkamp <dverkamp@chromium.org> | Tue Apr 15 00:56:42 2025 |
committer | crosvm LUCI <crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed Apr 16 21:16:41 2025 |
tree | 0dcef3273d09715739810ad8cad0018259d15f49 | |
parent | a54b440463a4f51007cc0a31b59d29fdc5527ad4 [diff] |
devices: virtio-balloon: change vq indexes based on features The virtio specification for the traditional memory balloon device contains some unclear wording related to virtqueue numbering. The interpretation crosvm has been using does not match the interpretation used by the Linux driver, nor the QEMU balloon device, so change crosvm to match reality. In particular, this affects the page reporting feature (--balllon-page-reporting), which did not work with the upstream Linux virtio-balloon driver previously. The specification assigns fixed numbers to each virtqueue (for example, vq 2 is statsq, 3 is free_page_vq, and 4 is reporting_vq); however, the spec also says that these feature-controlled virtqueues only "exist" when the corresponding feature is "set". The different interpretations are due to these words, whose meaning is not defined in the spec. crosvm assumed that this meant that the vq indexes would remain fixed (and the queues that didn't "exist" would simply be non-functional if the driver attempted to modify any queue properties or enable the queue), whereas QEMU and Linux interpreted this to mean that if a device does not advertise the corresponding feature, that vq is totally removed from the list and its vq index is reused for the next feature-dependent vq, and so on for following vqs. This change modifies crosvm to work like QEMU, so now the advertised features (note: not the features acknowledged by the driver) control whether a given queue "exists" or if it should be totally removed and its index reused for other queues. TEST: crosvm run --balloon-page-reporting Change-Id: I76a29744028574ddc5aa31fbb97d0a2f8ece80f2 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/6454902 Commit-Queue: Daniel Verkamp <dverkamp@chromium.org> Reviewed-by: Frederick Mayle <fmayle@google.com>
crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the ChromeOS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.
crosvm is currently used to run Linux/Android guests on ChromeOS devices.