diff --git a/src/linux.rs b/src/linux.rs index 2ca40bea68..7bad24eb44 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -2603,18 +2603,18 @@ where ) } -/// Signals all running VCPUs to vmexit, sends VmRunMode message to each VCPU tube, and tells -/// `irq_chip` to stop blocking halted VCPUs. The tube message is set first because both the +/// Signals all running VCPUs to vmexit, sends VcpuControl message to each VCPU tube, and tells +/// `irq_chip` to stop blocking halted VCPUs. The channel message is set first because both the /// signal and the irq_chip kick could cause the VCPU thread to continue through the VCPU run /// loop. fn kick_all_vcpus( vcpu_handles: &[(JoinHandle<()>, mpsc::Sender)], irq_chip: &dyn IrqChip, - run_mode: &VmRunMode, + message: VcpuControl, ) { for (handle, tube) in vcpu_handles { - if let Err(e) = tube.send(VcpuControl::RunState(run_mode.clone())) { - error!("failed to send VmRunMode: {}", e); + if let Err(e) = tube.send(message.clone()) { + error!("failed to send VcpuControl: {}", e); } let _ = handle.kill(SIGRTMIN() + 0); } @@ -2976,7 +2976,7 @@ fn run_control( kick_all_vcpus( &vcpu_handles, linux.irq_chip.as_irq_chip(), - &VmRunMode::Suspending, + VcpuControl::RunState(VmRunMode::Suspending), ); } Token::ChildSignal => { @@ -3090,7 +3090,7 @@ fn run_control( kick_all_vcpus( &vcpu_handles, linux.irq_chip.as_irq_chip(), - &other, + VcpuControl::RunState(other), ); } } @@ -3267,7 +3267,7 @@ fn run_control( kick_all_vcpus( &vcpu_handles, linux.irq_chip.as_irq_chip(), - &VmRunMode::Exiting, + VcpuControl::RunState(VmRunMode::Exiting), ); for (handle, _) in vcpu_handles { if let Err(e) = handle.join() { diff --git a/vm_control/src/gdb.rs b/vm_control/src/gdb.rs index cf1cf6dd78..1cb4d477fd 100644 --- a/vm_control/src/gdb.rs +++ b/vm_control/src/gdb.rs @@ -7,7 +7,7 @@ use gdbstub::arch::x86::reg::X86_64CoreRegs as CoreRegs; use vm_memory::GuestAddress; /// Messages that can be sent to a vCPU to set/get its state from the debugger. -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum VcpuDebug { ReadMem(GuestAddress, usize), ReadRegs, diff --git a/vm_control/src/lib.rs b/vm_control/src/lib.rs index 42521662bd..8050813428 100644 --- a/vm_control/src/lib.rs +++ b/vm_control/src/lib.rs @@ -57,7 +57,7 @@ pub use crate::gdb::*; pub use hypervisor::MemSlot; /// Control the state of a particular VM CPU. -#[derive(Debug)] +#[derive(Clone, Debug)] pub enum VcpuControl { #[cfg(all(target_arch = "x86_64", feature = "gdb"))] Debug(VcpuDebug),