mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
vmm: cpu: Disable KVM_FEATURE_ASYNC_PF_INT in CPUID
By disabling this KVM feature, we prevent the guest from using APF (Asynchronous Page Fault) mechanism. The kernel has recently switched to using interrupts to notify about a page being ready, but for some reasons, this is causing unexpected behavior with Cloud Hypervisor, as it will make the vcpu thread spin at 100%. While investigating the issue, it's better to disable the KVM feature to prevent 100% CPU usage in some cases. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
d4eaf746b5
commit
b92fe648e9
@ -59,6 +59,10 @@ const HYPERVISOR_ECX_BIT: u8 = 31; // Hypervisor ecx bit.
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
const MTRR_EDX_BIT: u8 = 12; // Hypervisor ecx bit.
|
||||
|
||||
// KVM feature bits
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
const KVM_FEATURE_ASYNC_PF_INT_BIT: u8 = 14;
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
pub const CPU_MANAGER_ACPI_SIZE: usize = 0xc;
|
||||
|
||||
@ -685,10 +689,22 @@ impl CpuManager {
|
||||
.map_err(Error::CpuidSgx)?;
|
||||
}
|
||||
|
||||
// Set CPU physical bits
|
||||
// Update some existing CPUID
|
||||
for entry in cpuid.as_mut_slice().iter_mut() {
|
||||
if entry.function == 0x8000_0008 {
|
||||
entry.eax = (entry.eax & 0xffff_ff00) | (phys_bits as u32 & 0xff);
|
||||
match entry.function {
|
||||
// Set CPU physical bits
|
||||
0x8000_0008 => {
|
||||
entry.eax = (entry.eax & 0xffff_ff00) | (phys_bits as u32 & 0xff);
|
||||
}
|
||||
// Disable KVM_FEATURE_ASYNC_PF_INT
|
||||
// This is required until we find out why the asynchronous page
|
||||
// fault is generating unexpected behavior when using interrupt
|
||||
// mechanism.
|
||||
// TODO: Re-enable KVM_FEATURE_ASYNC_PF_INT (#2277)
|
||||
0x4000_0001 => {
|
||||
entry.eax &= !(1 << KVM_FEATURE_ASYNC_PF_INT_BIT);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user