mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +00:00
vmm: cpu: Introduce concept of maximum vs boot vCPUs in CpuManager
For now the max vCPUs is the same as the boot vCPUs. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
669d9a8ae8
commit
df0907845a
@ -336,6 +336,7 @@ impl Vcpu {
|
|||||||
|
|
||||||
pub struct CpuManager {
|
pub struct CpuManager {
|
||||||
boot_vcpus: u8,
|
boot_vcpus: u8,
|
||||||
|
max_vcpus: u8,
|
||||||
io_bus: Weak<devices::Bus>,
|
io_bus: Weak<devices::Bus>,
|
||||||
mmio_bus: Arc<devices::Bus>,
|
mmio_bus: Arc<devices::Bus>,
|
||||||
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
ioapic: Option<Arc<Mutex<ioapic::Ioapic>>>,
|
||||||
@ -388,6 +389,7 @@ impl BusDevice for CpuManager {
|
|||||||
impl CpuManager {
|
impl CpuManager {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
boot_vcpus: u8,
|
boot_vcpus: u8,
|
||||||
|
max_vcpus: u8,
|
||||||
device_manager: &DeviceManager,
|
device_manager: &DeviceManager,
|
||||||
guest_memory: Arc<RwLock<GuestMemoryMmap>>,
|
guest_memory: Arc<RwLock<GuestMemoryMmap>>,
|
||||||
fd: Arc<VmFd>,
|
fd: Arc<VmFd>,
|
||||||
@ -396,6 +398,7 @@ impl CpuManager {
|
|||||||
) -> Result<Arc<Mutex<CpuManager>>> {
|
) -> Result<Arc<Mutex<CpuManager>>> {
|
||||||
let cpu_manager = Arc::new(Mutex::new(CpuManager {
|
let cpu_manager = Arc::new(Mutex::new(CpuManager {
|
||||||
boot_vcpus,
|
boot_vcpus,
|
||||||
|
max_vcpus,
|
||||||
io_bus: Arc::downgrade(&device_manager.io_bus().clone()),
|
io_bus: Arc::downgrade(&device_manager.io_bus().clone()),
|
||||||
mmio_bus: device_manager.mmio_bus().clone(),
|
mmio_bus: device_manager.mmio_bus().clone(),
|
||||||
ioapic: device_manager.ioapic().clone(),
|
ioapic: device_manager.ioapic().clone(),
|
||||||
@ -568,4 +571,12 @@ impl CpuManager {
|
|||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn boot_vcpus(&self) -> u8 {
|
||||||
|
self.boot_vcpus
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn max_vcpus(&self) -> u8 {
|
||||||
|
self.max_vcpus
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,8 +451,10 @@ impl Vm {
|
|||||||
let on_tty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
|
let on_tty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
|
||||||
|
|
||||||
let boot_vcpus = config.cpus.cpu_count;
|
let boot_vcpus = config.cpus.cpu_count;
|
||||||
|
let max_vcpus = config.cpus.cpu_count;
|
||||||
let cpu_manager = cpu::CpuManager::new(
|
let cpu_manager = cpu::CpuManager::new(
|
||||||
boot_vcpus,
|
boot_vcpus,
|
||||||
|
max_vcpus,
|
||||||
&device_manager,
|
&device_manager,
|
||||||
guest_memory.clone(),
|
guest_memory.clone(),
|
||||||
fd,
|
fd,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user