From 44d9c7fd42d09052f1237d352e198b86cd6bf6e3 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 16 Feb 2023 20:00:54 +0800 Subject: [PATCH] vmm: properly set vcpu state when thread exited Once error occur, vcpu thread may exit, this should be critical event for the whole VM, we should fire exit event and set vcpu state. If we don't set vcpu state, the shutdown process will hang at signal_thread, which is waiting the vcpu state to change. Signed-off-by: Yong He --- vmm/src/cpu.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index 3f785a64a..1d11c26d2 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -1035,12 +1035,16 @@ impl CpuManager { "VCPU generated error: {:?}", Error::UnexpectedVmExit ); + vcpu_run_interrupted.store(true, Ordering::SeqCst); + exit_evt.write(1).unwrap(); break; } }, Err(e) => { error!("VCPU generated error: {:?}", Error::VcpuRun(e.into())); + vcpu_run_interrupted.store(true, Ordering::SeqCst); + exit_evt.write(1).unwrap(); break; } }