All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: virtio-comment@lists.linux.dev
Subject: [PATCH v4 0/3] balloon: DEVICE_INIT_REPORTED and DEVICE_INIT_ON_INFLATE
Date: Thu, 7 May 2026 03:51:50 -0400	[thread overview]
Message-ID: <cover.1778140241.git.mst@redhat.com> (raw)

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(-)

-- 
MST


             reply	other threads:[~2026-05-07  7:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  7:51 Michael S. Tsirkin [this message]
2026-05-07  7:51 ` [PATCH v4 1/3] balloon: add Security Considerations section Michael S. Tsirkin
2026-05-15  8:53   ` Manos Pitsidianakis
2026-05-07  7:51 ` [PATCH v4 2/3] balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_REPORTED Michael S. Tsirkin
2026-05-15  9:02   ` Manos Pitsidianakis
2026-05-07  7:51 ` [PATCH v4 3/3] balloon: add VIRTIO_BALLOON_F_DEVICE_INIT_ON_INFLATE Michael S. Tsirkin
2026-05-15  9:09   ` Manos Pitsidianakis
2026-05-15  9:23     ` Michael S. Tsirkin
2026-05-15  9:28       ` Manos Pitsidianakis
2026-05-15  9:35         ` Michael S. Tsirkin
2026-05-15 10:46           ` Manos Pitsidianakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1778140241.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=virtio-comment@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.