mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-23 16:31:16 +00:00
vmm: tdx: Fix a deadlock while accessing vm_config
The lock to `vm_config` is held for accessing `cpus.kvm_hyperv` passing
as a reference to `arch::generate_common_cpuid()`, so acquiring the same
lock again while calling to the same function is a deadlock.
Fixes: 3793ffe888
Reported-by: Yi Wang <foxywang@tencent.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
1b59ab3d7b
commit
aa6e83126c
@ -1663,6 +1663,8 @@ impl Vmm {
|
|||||||
let vm_config = vm.get_config();
|
let vm_config = vm.get_config();
|
||||||
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
|
||||||
let common_cpuid = {
|
let common_cpuid = {
|
||||||
|
#[cfg(feature = "tdx")]
|
||||||
|
let tdx_enabled = vm_config.lock().unwrap().is_tdx_enabled();
|
||||||
let phys_bits =
|
let phys_bits =
|
||||||
vm::physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
vm::physical_bits(&hypervisor, vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||||
arch::generate_common_cpuid(
|
arch::generate_common_cpuid(
|
||||||
@ -1671,7 +1673,7 @@ impl Vmm {
|
|||||||
phys_bits,
|
phys_bits,
|
||||||
vm_config.lock().unwrap().cpus.kvm_hyperv,
|
vm_config.lock().unwrap().cpus.kvm_hyperv,
|
||||||
#[cfg(feature = "tdx")]
|
#[cfg(feature = "tdx")]
|
||||||
vm_config.lock().unwrap().is_tdx_enabled(),
|
tdx_enabled,
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
MigratableError::MigrateReceive(anyhow!("Error generating common cpuid': {:?}", e))
|
MigratableError::MigrateReceive(anyhow!("Error generating common cpuid': {:?}", e))
|
||||||
|
Loading…
Reference in New Issue
Block a user