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

Method remove_vcpu

vmm/src/cpu.rs:3188–3201  ·  view source on GitHub ↗

Removes a vCPU from the guest. The corresponding vCPU thread will be gracefully stopped and joined.

(cpu_id: u32, state: &mut VcpuState)

Source from the content-addressed store, hash-verified

3186 ///
3187 /// The corresponding vCPU thread will be gracefully stopped and joined.
3188 fn remove_vcpu(cpu_id: u32, state: &mut VcpuState) -> Result<()> {
3189 info!("Removing vCPU: cpu_id = {cpu_id}");
3190 state.kill.store(true, Ordering::SeqCst);
3191 state.signal_thread();
3192 state.wait_until_signal_acknowledged()?;
3193 state.join_thread()?;
3194 state.handle = None;
3195
3196 // Once the thread has exited, clear the "kill" so that it can reused
3197 state.kill.store(false, Ordering::SeqCst);
3198 state.pending_removal.store(false, Ordering::SeqCst);
3199
3200 Ok(())
3201 }
3202}
3203
3204impl BusDevice for AcpiCpuHotplugController {

Callers

nothing calls this directly

Calls 3

signal_threadMethod · 0.80
join_threadMethod · 0.80

Tested by

no test coverage detected