vmm: cpu: Unpause vCPU threads

After setting the kill signal flag for the vCPU thread release the pause
flag and unpark the threads. This ensures that that the vCPU thread will
wake up and check the kill signal flag if the VM is paused.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-05-06 10:24:19 +01:00 committed by Sebastien Boeuf
parent 91a4a2581e
commit 801e72ac6d

View File

@ -193,6 +193,9 @@ pub enum Error {
/// Failed to set KVM vcpu XCRS.
VcpuSetXcrs(kvm_ioctls::Error),
/// Error resuming vCPU on shutdown
ResumeOnShutdown(MigratableError),
}
pub type Result<T> = result::Result<T, Error>;
@ -953,6 +956,9 @@ impl CpuManager {
// Tell the vCPUs to stop themselves next time they go through the loop
self.vcpus_kill_signalled.store(true, Ordering::SeqCst);
// Clear pause state and unpark the vCPU threads if they are parked.
self.resume().map_err(Error::ResumeOnShutdown)?;
// Signal to the spawned threads (vCPUs and console signal handler). For the vCPU threads
// this will interrupt the KVM_RUN ioctl() allowing the loop to check the boolean set
// above.