mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-11 23:27:40 +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>
(cherry picked from commit aa6e83126cf50bc5b334deb74ebff606d8cf2beb)
This commit is contained in:
parent
ab18a923f1
commit
77634a3c05
@ -1471,6 +1471,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 = vm::physical_bits(vm_config.lock().unwrap().cpus.max_phys_bits);
|
let phys_bits = vm::physical_bits(vm_config.lock().unwrap().cpus.max_phys_bits);
|
||||||
arch::generate_common_cpuid(
|
arch::generate_common_cpuid(
|
||||||
hypervisor,
|
hypervisor,
|
||||||
@ -1479,7 +1481,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…
x
Reference in New Issue
Block a user