Skip to content

Commit a60088b

Browse files
committed
chore(vmm): Warn on unexpected subleaf for CPUID leaf 0xB
KVM no longer returns any subleaves greater than 0. The patch was merged in v6.2 and backported to v5.10. So for all our supported kernels, subleaves >= 2 should not be included [1]. However, we intentionally leave Firecracker not fail for unsupported kernels to keep working. Note that we can detect KVM regression thanks to the test that compares a fingerprint with its baseline. So prints a warning message without bailing out. [1]: torvalds/linux@45e966f Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 85aed85 commit a60088b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/vmm/src/cpu_config/x86_64/cpuid/normalize.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use crate::cpu_config::x86_64::cpuid::{
55
CpuidEntry, CpuidKey, CpuidRegisters, CpuidTrait, KvmCpuidFlags, cpuid,
66
};
7+
use crate::logger::warn;
78
use crate::vmm_config::machine_config::MAX_SUPPORTED_VCPUS;
89

910
/// Error type for [`super::Cpuid::normalize`].
@@ -370,8 +371,15 @@ impl super::Cpuid {
370371
.map_err(|err| ExtendedTopologyError::DomainType(index, err))?;
371372
}
372373
_ => {
373-
// We expect here as this is an extremely rare case that is unlikely to ever
374-
// occur.
374+
// KVM no longer returns any subleaves greater than 0. The patch was merged
375+
// in v6.2 and backported to v5.10. So for all our supported kernels,
376+
// subleaves >= 2 should not be included.
377+
// https://github.com/torvalds/linux/commit/45e966fcca03ecdcccac7cb236e16eea38cc18af
378+
//
379+
// However, we intentionally leave Firecracker not fail for unsupported
380+
// kernels to keep working. Note that we can detect KVM regression thanks
381+
// to the test that compares a fingerprint with its baseline.
382+
warn!("Subleaf {index} not expected for CPUID leaf 0xB.");
375383
subleaf.result.ecx = index;
376384
}
377385
}

0 commit comments

Comments
 (0)