Skip to content

HV: pause/resume/snapshot dispatch is VZ-only (correctness defect) #251

Closed

Description

@AprilNEA

Problem

Pause, resume, and snapshot operations dispatch to VZ-specific code regardless of which backend is actually running the VM. HV-backed VMs either call Virtualization.framework APIs (unsound — no VZ VM object exists) or error out opaquely.

Affected call sites in virt/arcbox-vmm/src/vmm/mod.rs

  • pause() at line 552 — unconditionally calls pause_darwin_vm().
  • resume() at line 581 — unconditionally calls resume_darwin_vm().
  • capture_snapshot_context() at line 686 — dispatches to capture_snapshot_darwin() (VZ framework call in darwin.rs).
  • restore_from_snapshot_data() at line 732 — dispatches to restore_snapshot_darwin() (VZ framework call).

Impact

Correctness defect on the default macOS backend. Any pause/resume flow (desktop suspend-on-close, snapshot save, live migration) is broken for HV-backed VMs.

Fix

  1. Branch on self.resolved_backend (or equivalent backend tag) in each of the four entry points.
  2. Implement HV-side equivalents:
    • Pause: hv_vcpus_exit() to stop vCPU threads, drain in-flight virtio work via worker join, record the pause timestamp.
    • Resume: re-enter vCPU loop; virtqueue state is already in guest memory and resumes naturally.
    • Snapshot: for M1, return Err(Unsupported) with a clear message so callers can degrade gracefully. Full HV snapshot is a larger project (guest RAM serialize, device state capture) and should be its own issue.
  3. Add unit tests that exercise each entry point with an HV backend tag and assert the right path is taken.

Files

  • virt/arcbox-vmm/src/vmm/mod.rs:552, 581, 686, 732
  • virt/arcbox-vmm/src/vmm/darwin_hv/mod.rs (new pause/resume logic)

Acceptance

  • All four entry points dispatch on backend.
  • HV pause + resume works end-to-end with a booted Linux guest (smoke test: ping before, pause 5s, resume, ping still works).
  • HV snapshot returns a clear Unsupported error (or lands a separate implementation tracked elsewhere).

Activity

  1. linear commented on Apr 17, 2026

    @linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions