mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +00:00
vmm: Only generate GED interrupt when the number of vCPUs has changed
Avoid activity in the the guest OS if the number of vCPUs has not changed. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
8049666eff
commit
211786ab42
@ -661,11 +661,11 @@ impl CpuManager {
|
|||||||
self.activate_vcpus(self.boot_vcpus(), Some(entry_addr))
|
self.activate_vcpus(self.boot_vcpus(), Some(entry_addr))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize(&mut self, desired_vcpus: u8) -> Result<()> {
|
pub fn resize(&mut self, desired_vcpus: u8) -> Result<bool> {
|
||||||
match desired_vcpus.cmp(&self.present_vcpus()) {
|
match desired_vcpus.cmp(&self.present_vcpus()) {
|
||||||
cmp::Ordering::Greater => self.activate_vcpus(desired_vcpus, None),
|
cmp::Ordering::Greater => self.activate_vcpus(desired_vcpus, None).and(Ok(true)),
|
||||||
cmp::Ordering::Less => self.mark_vcpus_for_removal(desired_vcpus),
|
cmp::Ordering::Less => self.mark_vcpus_for_removal(desired_vcpus).and(Ok(true)),
|
||||||
_ => Ok(()),
|
_ => Ok(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,14 +485,17 @@ impl Vm {
|
|||||||
|
|
||||||
pub fn resize(&mut self, desired_vcpus: Option<u8>, desired_memory: Option<u64>) -> Result<()> {
|
pub fn resize(&mut self, desired_vcpus: Option<u8>, desired_memory: Option<u64>) -> Result<()> {
|
||||||
if let Some(desired_vcpus) = desired_vcpus {
|
if let Some(desired_vcpus) = desired_vcpus {
|
||||||
self.cpu_manager
|
if self
|
||||||
|
.cpu_manager
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.resize(desired_vcpus)
|
.resize(desired_vcpus)
|
||||||
.map_err(Error::CpuManager)?;
|
.map_err(Error::CpuManager)?
|
||||||
|
{
|
||||||
self.devices
|
self.devices
|
||||||
.notify_hotplug(HotPlugNotificationFlags::CPU_DEVICES_CHANGED)
|
.notify_hotplug(HotPlugNotificationFlags::CPU_DEVICES_CHANGED)
|
||||||
.map_err(Error::DeviceManager)?;
|
.map_err(Error::DeviceManager)?;
|
||||||
|
}
|
||||||
self.config.lock().unwrap().cpus.boot_vcpus = desired_vcpus;
|
self.config.lock().unwrap().cpus.boot_vcpus = desired_vcpus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user