From 91a4a2581e879ea1e7d29e6438d6e433f8296715 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 6 May 2020 09:59:46 +0100 Subject: [PATCH] vmm: cpu: When coming out of the pause event check for a kill signal Rather than immediately entering the vCPU run() code check if the kill signal is set. This allows paused VMs to be shutdown. Signed-off-by: Rob Bradford --- vmm/src/cpu.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 05047a371..38dab7091 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -873,6 +873,13 @@ impl CpuManager { while vcpu_pause_signalled.load(Ordering::SeqCst) { thread::park(); } + + // We've been told to terminate + if vcpu_kill_signalled.load(Ordering::SeqCst) + || vcpu_kill.load(Ordering::SeqCst) + { + break; + } } }) .map_err(Error::VcpuSpawn)?,