Repository navigation
fix(virtio): respect PAGE_POISON in balloon config and free page reporting - #542
Merged
Merged
Conversation
Coverage Report for CI Build 46822394635Coverage increased (+0.7%) to 47.522%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Lencerf
force-pushed
the
fix/balloon-page-poison
branch
from
December 2, 2026 06:05
4e2b04e to
973e6d5
Compare
…rting VIRTIO_BALLOON_F_PAGE_POISON is offered by the balloon device, so the guest may write `poison_val` in the device configuration space and expect reported free pages to retain that value (Virtio v1.4 Sec 5.5.6.6). Previously, writes to `poison_val` were rejected and free page reporting unconditionally discarded pages, overwriting non-zero poison patterns with zeroes. Allow driver writes to `poison_val`, reset driver-written state on device reset, and keep reported free pages intact when PAGE_POISON is negotiated with a non-zero `poison_val`. Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Lencerf
force-pushed
the
fix/balloon-page-poison
branch
from
December 2, 2026 06:09
973e6d5 to
6f04440
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BalloonConfig::poison_valalongsideBalloonConfig::actualviaBalloonConfig::LAYOUT_POISON_VAL, while continuing to reject writes to read-only fields (num_pages,free_page_hint_cmd_id), sub-word or unaligned accesses, invalid access widths, and out-of-bounds offsets.BalloonFeaturebits onBalloonduringVirtioMio::activate, and cleardriver_feature,actual, andpoison_valonVirtioMio::reset.VIRTIO_BALLOON_F_PAGE_POISONis negotiated: skipmadvise(..., MADV_DONTNEED)whenpoison_val != 0so reported free pages are not overwritten with zeroes, while continuing to reclaim reported pages whenPAGE_POISONis not negotiated orpoison_val == 0.alioth/src/virtio/dev/balloon_test.rscoveringBalloonConfigMmioread/write validation,free_reportingunder allPAGE_POISON/poison_valcombinations, and devicereset+ re-activation on both 4 KiB and 16 KiB page hosts.Verification
cargo +nightly fmt --checkcargo test -p alioth virtio::dev::ballooncargo clippy --all-targets -- -D warningscargo clippy --all-targets --target x86_64-unknown-linux-gnu -- -D warnings