vmm: add guest exit event path

Introduce a dedicated guest_exit_evt and a matching epoll dispatch
path for guest-triggered shutdowns.

This series is needed because managment software such as libvirt may
still need the Cloud Hypervisor process to stay alive after the guest
has shut down.
Today a guest-triggered shutdown can make the VMM disappear immediately,
which means the managment software can lose track of the VM run-state.

This must only apply to guest-triggered shutdowns. Fatal error paths
and other internal exit paths must keep using the existing VMM exit
handling.

For now GuestExit still calls vmm_shutdown(), so this commit only adds
the separate plumbing and keeps the current behavior unchanged.

On-behalf-of: SAP leander.kohler@sap.com
Signed-off-by: Leander Kohler <leander.kohler@cyberus-technology.de>
This commit is contained in:
Leander Kohler
2026-03-09 16:02:40 +01:00
committed by Rob Bradford
parent dc0e003be0
commit c698075157
3 changed files with 48 additions and 0 deletions
+6
View File
@@ -536,6 +536,7 @@ impl Vm {
vm: Arc<dyn hypervisor::Vm>,
exit_evt: EventFd,
reset_evt: EventFd,
guest_exit_evt: EventFd,
#[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
seccomp_action: &SeccompAction,
hypervisor: Arc<dyn hypervisor::Hypervisor>,
@@ -604,6 +605,7 @@ impl Vm {
cpu_manager.clone(),
exit_evt.try_clone().map_err(Error::EventFdClone)?,
reset_evt,
guest_exit_evt,
seccomp_action.clone(),
numa_nodes.clone(),
&activate_evt,
@@ -790,6 +792,7 @@ impl Vm {
cpu_manager: Arc<Mutex<cpu::CpuManager>>,
exit_evt: EventFd,
reset_evt: EventFd,
guest_exit_evt: EventFd,
seccomp_action: SeccompAction,
numa_nodes: NumaNodes,
activate_evt: &EventFd,
@@ -812,6 +815,7 @@ impl Vm {
cpu_manager,
exit_evt,
reset_evt,
guest_exit_evt,
seccomp_action,
numa_nodes,
activate_evt,
@@ -1247,6 +1251,7 @@ impl Vm {
vm_config: Arc<Mutex<VmConfig>>,
exit_evt: EventFd,
reset_evt: EventFd,
guest_exit_evt: EventFd,
#[cfg(feature = "guest_debug")] vm_debug_evt: EventFd,
seccomp_action: &SeccompAction,
hypervisor: Arc<dyn hypervisor::Hypervisor>,
@@ -1319,6 +1324,7 @@ impl Vm {
vm,
exit_evt,
reset_evt,
guest_exit_evt,
#[cfg(feature = "guest_debug")]
vm_debug_evt,
seccomp_action,