mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-25 21:02:25 +00:00
vmm: Ensure PIO/MMIO exits complete before pausing only for KVM
MSHV does not require to ensure MMIO/PIO exits complete before pausing. This patch makes sure the above requirement by checking the hypervisor type run-time. Fixes #5037 Signed-off-by: Muminul Islam <muislam@microsoft.com> (cherry picked from commit 4e3bc20f2ceac9ea3861b76512375cc5f295dc97)
This commit is contained in:
parent
3834b43878
commit
8dd4d42053
@ -61,7 +61,7 @@ pub use vm::{
|
|||||||
Vm, VmOps,
|
Vm, VmOps,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||||
pub enum HypervisorType {
|
pub enum HypervisorType {
|
||||||
Kvm,
|
Kvm,
|
||||||
Mshv,
|
Mshv,
|
||||||
|
@ -837,6 +837,8 @@ impl CpuManager {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let reset_evt = self.reset_evt.try_clone().unwrap();
|
let reset_evt = self.reset_evt.try_clone().unwrap();
|
||||||
let exit_evt = self.exit_evt.try_clone().unwrap();
|
let exit_evt = self.exit_evt.try_clone().unwrap();
|
||||||
|
#[cfg(feature = "kvm")]
|
||||||
|
let hypervisor_type = self.hypervisor_type;
|
||||||
#[cfg(feature = "guest_debug")]
|
#[cfg(feature = "guest_debug")]
|
||||||
let vm_debug_evt = self.vm_debug_evt.try_clone().unwrap();
|
let vm_debug_evt = self.vm_debug_evt.try_clone().unwrap();
|
||||||
let panic_exit_evt = self.exit_evt.try_clone().unwrap();
|
let panic_exit_evt = self.exit_evt.try_clone().unwrap();
|
||||||
@ -941,12 +943,14 @@ impl CpuManager {
|
|||||||
|
|
||||||
#[cfg(feature = "kvm")]
|
#[cfg(feature = "kvm")]
|
||||||
{
|
{
|
||||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(true);
|
if matches!(hypervisor_type, HypervisorType::Kvm) {
|
||||||
if !matches!(vcpu.lock().unwrap().run(), Ok(VmExit::Ignore)) {
|
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(true);
|
||||||
error!("Unexpected VM exit on \"immediate_exit\" run");
|
if !matches!(vcpu.lock().unwrap().run(), Ok(VmExit::Ignore)) {
|
||||||
break;
|
error!("Unexpected VM exit on \"immediate_exit\" run");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(false);
|
||||||
}
|
}
|
||||||
vcpu.lock().as_ref().unwrap().vcpu.set_immediate_exit(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vcpu_run_interrupted.store(true, Ordering::SeqCst);
|
vcpu_run_interrupted.store(true, Ordering::SeqCst);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user