Skip to content

macOS/HVF: a first pause() ≥20 s after boot crashes the guest kernel on continue #377

Backlog

Description

@mobileskyfi

Context

Found by the macOS grounding run for #375 (PR #376): pause() is HMP stop, and continue() is cont.

On x86 under HVF (Intel Mac, macOS 26.6.2, QEMU 11.1.1, CHR 7.25.2, 1 vCPU, 512 MB), the first pause after each boot does not freeze guest time. On cont the guest sees the whole pause at once:

First pause after boot Result
3 s (×2) OK; uptime advanced the full wall time
10 s OK; uptime advanced the full wall time
20 s kernel failure, RouterOS reboots in the same QEMU (same PID)
30 s (×4, 15 s to 1:22 after boot) same; continue took ~27.7 s
  • RouterOS logs system,error,critical kernel failure in previous boot and writes an autosupout.rif.
  • Every later pause in the same boot (five 30 s pauses) froze the clock as on KVM: uptime +2–3 s over 33–34 s of wall time, guest clock 32 s behind, continue in 2.4–3.0 s.
  • Linux/KVM does not do this. A 30 s pause straight after boot (uptime 21 s) kept a RAM :global, and uptime moved 2 s across about 32 s of wall time.
  • continue() reports success, because after the reboot REST answers again. Only the long wait and the reset uptime show what happened.

Suspected cause (unconfirmed): under HVF the TSC keeps counting across the first stop, and a jump of 20 s or more trips the guest kernel's soft-lockup limit (2 × 10 s). Later stops may freeze because the kernel has switched clocksource by then.

Open questions / possible work

  • Confirm the mechanism: the guest clocksource before and after the first resume, and whether -cpu host flags (invtsc and the like) or a QEMU version change matter.
  • Apple Silicon (arm64 under TCG) is untested.
  • Mitigation options: a short stop/cont "primer" right after boot on HVF; or pause() on HVF doing a quick stop/cont before the real stop, if that is enough.
  • Detection: continue() could notice a guest that rebooted during the resume (for example uptime compared with a value read before the pause, when REST is reachable) and say so instead of reporting a plain resume.
  • test/integration/pause-reset.test.ts now checks that a RAM value survives pause/continue, but its pause is about 5 s, below the threshold.

Documented as a caveat in MANUAL.md (pause) and qemu.instructions.md in #376.

Activity

  1. added
    bug
    area:qemu
    on Dec 2, 2026
  2. added a commit that references this issue on Dec 2, 2026
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

    area:qemubug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions