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:
Rob Bradford
2020-01-17 16:48:46 +00:00
committed by Samuel Ortiz
parent 8049666eff
commit 211786ab42
2 changed files with 12 additions and 9 deletions

View File

@@ -661,11 +661,11 @@ impl CpuManager {
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()) {
cmp::Ordering::Greater => self.activate_vcpus(desired_vcpus, None),
cmp::Ordering::Less => self.mark_vcpus_for_removal(desired_vcpus),
_ => Ok(()),
cmp::Ordering::Greater => self.activate_vcpus(desired_vcpus, None).and(Ok(true)),
cmp::Ordering::Less => self.mark_vcpus_for_removal(desired_vcpus).and(Ok(true)),
_ => Ok(false),
}
}