Documentation
¶
Overview ¶
Headless go-virtio balloon validate harness: boots tamago/amd64 under QEMU, drives a real virtio-balloon-pci device through the go-virtio/balloon driver, and proves the device actually consumes the inflate/deflate PFN buffers off the used ring. The guest reports BALLOON-VALIDATE: PASS/FAIL on the serial console; run-balloon.sh parses the verdict and also queries the QEMU monitor `info balloon` before/after as a host-side cross-check.
This mirrors the blk harness: a *real* virtio-balloon-pci device (not the fake transport the unit tests use) exercises the inflateq/deflateq bring-up, the PFN-array marshalling, the doorbell, and the used-ring consumption on actual QEMU emulation.
What the guest proves (any failure => FAIL):
- INIT: OpenVirtioBalloon binds DID 0x1045, negotiates VERSION_1, reads num_pages from device config, and sets up exactly two queues.
- INFLATE: posting nPages PFNs to inflateq returns without ErrRequestTimeout — i.e. the device CONSUMED the buffer off the used ring (a dead device would time out). Actual advances by nPages.
- DEFLATE: posting the same PFNs to deflateq likewise returns (device consumed it). Actual returns to zero.
- ROUND 2: a second inflate of a different size also consumes, proving the queues keep working across requests.
HOST-SIDE NOTE: this driver deliberately does NOT write the balloon `actual` field back to device config (common.ModernConfig exposes no device-config write path — a documented limitation), so the host's `info balloon` "actual" reflects the host-set TARGET, not the guest's guest-initiated inflate. The authoritative guest-side proof of the balloon mechanism is therefore the used-ring consumption asserted here; run-balloon.sh prints `info balloon` for transparency but does not gate on it.