mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: vmm: mshv: Enable SMT for guests with threads_per_core > 1
Set HV_PARTITION_CREATION_FLAG_SMT_ENABLED_GUEST when the guest topology has more than one thread per core. This allows the hypervisor to schedule guest VPs correctly on SMT-enabled hosts. Without this flag, the hypervisor schedules guest VPs incorrectly, causing SMT unusable. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
e3a2bf0870
commit
a00189cf72
@@ -171,6 +171,7 @@ pub struct HypervisorVmConfig {
|
||||
#[cfg(feature = "sev_snp")]
|
||||
pub mem_size: u64,
|
||||
pub nested: bool,
|
||||
pub smt_enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
|
||||
@@ -307,6 +307,10 @@ impl hypervisor::Hypervisor for MshvHypervisor {
|
||||
.__bindgen_anon_1
|
||||
.set_nested_virt_support(1u64);
|
||||
}
|
||||
|
||||
if _config.smt_enabled {
|
||||
create_args.pt_flags |= 1 << MSHV_PT_BIT_SMT_ENABLED_GUEST;
|
||||
}
|
||||
}
|
||||
// Modified feature bit fields are written back to create_args
|
||||
for i in 0..create_args.pt_num_cpu_fbanks {
|
||||
|
||||
@@ -221,6 +221,11 @@ impl From<&VmConfig> for hypervisor::HypervisorVmConfig {
|
||||
#[cfg(feature = "sev_snp")]
|
||||
mem_size: _value.memory.total_size(),
|
||||
nested: _value.cpus.nested,
|
||||
smt_enabled: _value
|
||||
.cpus
|
||||
.topology
|
||||
.as_ref()
|
||||
.is_some_and(|t| t.threads_per_core > 1),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user