vmm: cpu: Resume before shutdown in a specific way

Instead of calling the resume() function from the CpuManager, which
involves more than what is needed from the shutdown codepath, and
potentially ends up with a deadlock, we replace it with a subset.

The full resume operation is reserved for a VM that has been paused.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2020-06-24 12:25:06 +02:00
parent 65132fb99d
commit 18e7d7a1f7

View File

@ -944,8 +944,13 @@ impl CpuManager {
// Tell the vCPUs to stop themselves next time they go through the loop // Tell the vCPUs to stop themselves next time they go through the loop
self.vcpus_kill_signalled.store(true, Ordering::SeqCst); self.vcpus_kill_signalled.store(true, Ordering::SeqCst);
// Clear pause state and unpark the vCPU threads if they are parked. // Toggle the vCPUs pause boolean
self.resume().map_err(Error::ResumeOnShutdown)?; self.vcpus_pause_signalled.store(false, Ordering::SeqCst);
// Unpark all the VCPU threads.
for state in self.vcpu_states.iter() {
state.unpark_thread();
}
// Signal to the spawned threads (vCPUs and console signal handler). For the vCPU threads // 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 // this will interrupt the KVM_RUN ioctl() allowing the loop to check the boolean set