From 451502b50b65e6cdb145981ce49fab9b179d7529 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 19 Aug 2019 18:12:05 +0100 Subject: [PATCH] vm: If a VCPU thread errors out then exit the hypervisor Currently when the VCPU thread exits on an error the VMM continues to run with no way of shutting down the main thread. Signed-off-by: Rob Bradford --- vmm/src/vm.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index eb0badd42..5df39c734 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -1781,6 +1781,7 @@ impl<'a> Vm<'a> { let vcpu_thread_barrier = vcpu_thread_barrier.clone(); + let exit_evt = self.devices.exit_evt.try_clone().unwrap(); self.vcpus.push( thread::Builder::new() .name(format!("cloud-hypervisor_vcpu{}", vcpu.id)) @@ -1802,6 +1803,7 @@ impl<'a> Vm<'a> { vcpu_thread_barrier.wait(); while vcpu.run().is_ok() {} + exit_evt.write(1).unwrap(); }) .map_err(Error::VcpuSpawn)?, );