Skip to content

balloon: DEVICE_INIT_REPORTED and DEVICE_INIT_ON_INFLATE

Michael S. Tsirkin virtio-comment 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 7 repliesIn review
  2. v32 patches 0 repliesSuperseded
  3. v12 patches 0 repliesSuperseded

Changes in v4 from the cover letter

- Added Security Considerations
- ON_INFLATE bitmap: allow device to write fewer or more bytes.
- Restore "or 0 otherwise" from v2 for failed PFNs within written bytes.
- Device MUST NOT modify a page after reporting it as initialized.
- Device MUST provide inflateq supporting at least 2 buffers.
- Qualify driver "MUST treat as uninitialized" rule with DEVICE_INIT_REPORTED (matching the device-side condition).

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3balloon: add Security Considerations sectiondevice-types/balloon/description.tex+28 -01 reply
2/3balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_REPORTEDdevice-types/balloon/description.tex+57 -31 reply
3/3balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATEdevice-types/balloon/description.tex+71 -25 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchManos Pitsidianakis
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] balloon: DEVICE_INIT_REPORTED and DEVICE_INIT_ON_INFLATE

Once a page gets out of balloon (on deflate, or on access for reporting) the Linux guest inits it before giving it to app. It's a waste - the page is already inited by the host.

Add balloon support for skipping that, that provides significant performance gains.

This adds two new feature bits for the balloon device that allow the device to signal that it has initialized (zeroed or poison-filled) pages on behalf of the driver.

The variant with poison does not really seem useful, so I am still trying to figure out whether we should simply outlaw it.

Implementation:
QEMU: https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git balloon
Linux: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git balloon

Tested with QEMU + Linux guest: 232ms -> 51ms (-78%) for 256MB page allocation in a 2GB VM.

Changes since v3 (insights after implementing):
- Added Security Considerations
- ON_INFLATE bitmap: allow device to write fewer or more bytes.
- Restore "or 0 otherwise" from v2 for failed PFNs within written bytes.
- Device MUST NOT modify a page after reporting it as initialized.
- Device MUST provide inflateq supporting at least 2 buffers.
- Qualify driver "MUST treat as uninitialized" rule with DEVICE_INIT_REPORTED (matching the device-side condition).

Changes since v2:
- I realized we can't really avoid a new feature bit:
poison is a promise from driver to initialize pages.
- added clarifications for poison
- lots of other changes

Changes v1->v2:
- reporting can actually just utilize used length to see what was initialized! so we do not need a bitmap for that.
- qemu really needs a way to skip init for some pages. Add that to inflate path.
Add security considerations (for coco).

Michael S. Tsirkin (3):
balloon: add Security Considerations section
balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_REPORTED
balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE

 device-types/balloon/description.tex | 157 ++++++++++++++++++++++++++-
 1 file changed, 154 insertions(+), 3 deletions(-)

--
MST

Michael S. Tsirkin (3):
balloon: add Security Considerations section
balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_REPORTED
balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE

 device-types/balloon/description.tex | 157 ++++++++++++++++++++++++++-
 1 file changed, 154 insertions(+), 3 deletions(-)
Signature · 1 line
MST