Skip to content

virtio-fs: wake the VMM when the guest reports an exit code#610

Open
yzewei wants to merge 1 commit intocontainers:mainfrom
yzewei:virtio_exit_evt_miss
Open

virtio-fs: wake the VMM when the guest reports an exit code#610
yzewei wants to merge 1 commit intocontainers:mainfrom
yzewei:virtio_exit_evt_miss

Conversation

@yzewei
Copy link
Copy Markdown
Contributor

@yzewei yzewei commented Mar 27, 2026

When a virtual machine (VM) passes its final exit status via the KRUN_EXIT_CODE_IOCTL function on the virtio-fs root filesystem, the host records it in the shared exit_code AtomicI32, but does not signal it to the VMM's EventFd.

The VMM only stops when exit_evt becomes readable, so the VM's reported exit status itself does not wake up the EventManager and terminate the VM.

This is a common bug in virtio-fs/VMM exit interactions, not a code path specific to any particular architecture (but the reset path on x86-64 i8042 is configured as a VMM exit event, masking the problem). User-visible symptoms depend on the architecture/platform:

  • On platforms without an equivalent rollback mechanism, or where the VM continues to perform reboot/shutdown processing after reporting the exit code, it may continue running even after reporting completion.

We observed the latter scenario on LoongArch, where the virtual machine could continue to restart/shut down, eventually leading to a soft lock rather than the VMM exiting immediately.

@yzewei yzewei changed the title virtio-fs: signal exit_evt when guest reports an exit code virtio-fs: wake the VMM when the guest reports an exit code Mar 27, 2026
@yzewei yzewei force-pushed the virtio_exit_evt_miss branch 3 times, most recently from b2be1f2 to 3fa25a3 Compare March 27, 2026 08:30
When a virtual machine (VM) passes its final exit status via the `KRUN_EXIT_CODE_IOCTL` function on the virtio-fs root filesystem, the host records it in the shared `exit_code` AtomicI32, but does not signal it to the VMM's `EventFd`.

The VMM only stops when `exit_evt` becomes readable, so the VM's reported exit status itself does not wake up the `EventManager` and terminate the VM.

This is a common bug in virtio-fs/VMM exit interactions, not a code path specific to any particular architecture (but the reset path on x86-64 i8042 is configured as a VMM exit event, masking the problem). User-visible symptoms depend on the architecture/platform:

- On platforms without an equivalent rollback mechanism, or where the VM continues to perform reboot/shutdown processing after reporting the exit code, it may continue running even after reporting completion.

We observed the latter scenario on LoongArch, where the virtual machine could continue to restart/shut down, eventually leading to a soft lock rather than the VMM exiting immediately.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
@yzewei yzewei force-pushed the virtio_exit_evt_miss branch from 3fa25a3 to 36b3fe3 Compare March 27, 2026 08:34
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