Skip to content

[codex] add linux amd64 virtio balloon support#49

Merged
Vbitz merged 2 commits into
mainfrom
codex/linux-amd64-balloon
Jul 3, 2026
Merged

[codex] add linux amd64 virtio balloon support#49
Vbitz merged 2 commits into
mainfrom
codex/linux-amd64-balloon

Conversation

@Vbitz

@Vbitz Vbitz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds Linux/amd64 KVM support for the virtio balloon work from the Darwin branch.

  • wires virtio.Balloon into KVM managed sessions, one-shot exec, MMIO dispatch, and startup snapshot state
  • passes requested balloon targets through Linux managed attachments and runtime requests
  • reclaims inflated guest pages with madvise(MADV_DONTNEED) while preserving the existing guest memory mapping
  • preserves existing amd64 MMIO addresses and adds the balloon at a new slot

Validation

  • go test ./internal/hv/kvm ./internal/virtio

Full go test ./... still reaches existing Linux runtime tests that require an embedded amd64 guest-init payload (build ccvm with -tags embed_guestinit).

@Vbitz Vbitz marked this pull request as ready for review July 3, 2026 06:52
@Vbitz Vbitz force-pushed the codex/virtio-balloon-darwin branch from ee0fa2c to 19a6b4a Compare July 3, 2026 07:28

Vbitz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up pushed: 57cea75 loads CONFIG_VIRTIO_BALLOON / virtio_balloon.ko.gz for Linux/amd64 and broadens the existing virtio balloon runtime boot test to cover Linux/amd64.

Additional validation now passing locally:

  • go test ./internal/vm -run TestRuntimeBootsLinuxWithVirtioBalloon -count=1
  • go test ./internal/hv/kvm ./internal/virtio ./internal/vm -run 'TestRuntimeBootsLinuxWithVirtioBalloon|TestLinuxManagedMachineSpec'

The first test boots a real Linux/amd64 guest and verifies the virtio balloon device is bound to the virtio_balloon driver.

@Vbitz Vbitz force-pushed the codex/virtio-balloon-darwin branch from 19a6b4a to a8a8792 Compare July 3, 2026 09:59
@Vbitz Vbitz force-pushed the codex/linux-amd64-balloon branch from 1de1302 to ee12a10 Compare July 3, 2026 10:13
@Vbitz Vbitz changed the base branch from codex/virtio-balloon-darwin to main July 3, 2026 10:13
@Vbitz

Vbitz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto cc/main now that Darwin balloon support has merged. The PR now contains only the Linux amd64 balloon commits (eda86e5, ee12a10).

Validation run locally:

  • go test ./cmd/ccvm ./cmd/cc ./internal/guestinit ./internal/linux/boot/amd64 ./internal/linux/initramfs -count=1
  • go test ./internal/hv/kvm ./internal/vm ./internal/vm/host/kvm -count=1 reached the known local internal/vm startup-snapshot FPU guest panic, while internal/hv/kvm and internal/vm/host/kvm passed.

@Vbitz Vbitz added this pull request to the merge queue Jul 3, 2026
Merged via the queue into main with commit 1015255 Jul 3, 2026
11 checks passed
@Vbitz Vbitz deleted the codex/linux-amd64-balloon branch July 3, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant