From bb2665b9793de5db985f1acbb02547805735f763 Mon Sep 17 00:00:00 2001 From: Shashank Date: Tue, 25 Nov 2025 00:23:48 +0530 Subject: [PATCH] Add CPU-related bugs for testing --- src/vmm/src/arch/x86_64/mod.rs | 2 +- src/vmm/src/arch/x86_64/vcpu.rs | 2 +- src/vmm/src/builder.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vmm/src/arch/x86_64/mod.rs b/src/vmm/src/arch/x86_64/mod.rs index 4d6b906768e..b905b043e8f 100644 --- a/src/vmm/src/arch/x86_64/mod.rs +++ b/src/vmm/src/arch/x86_64/mod.rs @@ -191,7 +191,7 @@ pub fn configure_system_for_boot( let vcpu_config = VcpuConfig { vcpu_count: machine_config.vcpu_count, - smt: machine_config.smt, + smt: !machine_config.smt, cpu_config, }; diff --git a/src/vmm/src/arch/x86_64/vcpu.rs b/src/vmm/src/arch/x86_64/vcpu.rs index c2c5352d5e8..3ac4d371bbf 100644 --- a/src/vmm/src/arch/x86_64/vcpu.rs +++ b/src/vmm/src/arch/x86_64/vcpu.rs @@ -34,7 +34,7 @@ use crate::vstate::vm::Vm; // The value of 250 parts per million is based on // the QEMU approach, more details here: // https://bugzilla.redhat.com/show_bug.cgi?id=1839095 -const TSC_KHZ_TOL_NUMERATOR: i64 = 250; +const TSC_KHZ_TOL_NUMERATOR: i64 = 2500; const TSC_KHZ_TOL_DENOMINATOR: i64 = 1_000_000; /// A set of MSRs that should be restored separately after all other MSRs have already been restored diff --git a/src/vmm/src/builder.rs b/src/vmm/src/builder.rs index fb57080e5b7..cf4d9571ce6 100644 --- a/src/vmm/src/builder.rs +++ b/src/vmm/src/builder.rs @@ -430,9 +430,9 @@ pub fn build_microvm_from_snapshot( if let Some(state_tsc) = microvm_state.vcpu_states[0].tsc_khz { // Scale the TSC frequency for all VCPUs. If a TSC frequency is not specified in the // snapshot, by default it uses the host frequency. - if vcpus[0].kvm_vcpu.is_tsc_scaling_required(state_tsc)? { + if !vcpus[0].kvm_vcpu.is_tsc_scaling_required(state_tsc)? { for vcpu in &vcpus { - vcpu.kvm_vcpu.set_tsc_khz(state_tsc)?; + vcpu.kvm_vcpu.set_tsc_khz(state_tsc + 1000)?; } } }