MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / resume

Method resume

vmm/src/cpu.rs:2637–2662  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2635 }
2636
2637 fn resume(&mut self) -> std::result::Result<(), MigratableError> {
2638 // Ensure that vCPUs keep running after being unpark() in
2639 // their run vCPU loop.
2640 self.vcpus_pause_signalled.store(false, Ordering::SeqCst);
2641
2642 let vcpu_states = self.vcpu_states.lock().unwrap();
2643
2644 // Unpark all the vCPU threads.
2645 // Step 1/2: signal each thread
2646 {
2647 for state in vcpu_states.iter() {
2648 state.unpark_thread();
2649 }
2650 }
2651 // Step 2/2: wait for state ACK
2652 {
2653 for state in vcpu_states.iter() {
2654 // wait for vCPU to update state
2655 while state.paused.load(Ordering::SeqCst) {
2656 // To avoid a priority inversion with the vCPU thread
2657 thread::sleep(std::time::Duration::from_millis(1));
2658 }
2659 }
2660 }
2661 Ok(())
2662 }
2663}
2664
2665impl Snapshottable for CpuManager {

Callers

nothing calls this directly

Calls 2

iterMethod · 0.80
unpark_threadMethod · 0.80

Tested by

no test coverage detected