mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
vmm: Fix build warning
Use the VM vcpus vector instead of creating a mutable one. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
5c9fc816de
commit
8f05773eae
@ -417,7 +417,7 @@ pub struct Vm<'a> {
|
|||||||
fd: VmFd,
|
fd: VmFd,
|
||||||
kernel: File,
|
kernel: File,
|
||||||
memory: GuestMemoryMmap,
|
memory: GuestMemoryMmap,
|
||||||
vcpus: Option<Vec<thread::JoinHandle<()>>>,
|
vcpus: Vec<thread::JoinHandle<()>>,
|
||||||
devices: DeviceManager,
|
devices: DeviceManager,
|
||||||
cpuid: CpuId,
|
cpuid: CpuId,
|
||||||
config: VmConfig<'a>,
|
config: VmConfig<'a>,
|
||||||
@ -497,11 +497,13 @@ impl<'a> Vm<'a> {
|
|||||||
.add_event(&device_manager.exit_evt, EpollDispatch::Exit)
|
.add_event(&device_manager.exit_evt, EpollDispatch::Exit)
|
||||||
.map_err(Error::EpollError)?;
|
.map_err(Error::EpollError)?;
|
||||||
|
|
||||||
|
let vcpus = Vec::with_capacity(config.vcpu_count as usize);
|
||||||
|
|
||||||
Ok(Vm {
|
Ok(Vm {
|
||||||
fd,
|
fd,
|
||||||
kernel,
|
kernel,
|
||||||
memory: guest_memory,
|
memory: guest_memory,
|
||||||
vcpus: None,
|
vcpus,
|
||||||
devices: device_manager,
|
devices: device_manager,
|
||||||
cpuid,
|
cpuid,
|
||||||
config,
|
config,
|
||||||
@ -597,7 +599,7 @@ impl<'a> Vm<'a> {
|
|||||||
|
|
||||||
let vcpu_count = self.config.vcpu_count;
|
let vcpu_count = self.config.vcpu_count;
|
||||||
|
|
||||||
let mut vcpus: Vec<thread::JoinHandle<()>> = Vec::with_capacity(vcpu_count as usize);
|
// let vcpus: Vec<thread::JoinHandle<()>> = Vec::with_capacity(vcpu_count as usize);
|
||||||
let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));
|
let vcpu_thread_barrier = Arc::new(Barrier::new((vcpu_count + 1) as usize));
|
||||||
|
|
||||||
for cpu_id in 0..vcpu_count {
|
for cpu_id in 0..vcpu_count {
|
||||||
@ -609,7 +611,7 @@ impl<'a> Vm<'a> {
|
|||||||
|
|
||||||
let vcpu_thread_barrier = vcpu_thread_barrier.clone();
|
let vcpu_thread_barrier = vcpu_thread_barrier.clone();
|
||||||
|
|
||||||
vcpus.push(
|
self.vcpus.push(
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name(format!("cloud-hypervisor_vcpu{}", vcpu.id))
|
.name(format!("cloud-hypervisor_vcpu{}", vcpu.id))
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
@ -700,10 +702,6 @@ impl<'a> Vm<'a> {
|
|||||||
|
|
||||||
self.control_loop()?;
|
self.control_loop()?;
|
||||||
|
|
||||||
for vcpu_barrier in vcpus {
|
|
||||||
vcpu_barrier.join().unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user