Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vmm: tdx: Fix a deadlock while accessing vm_config #5845

Merged

Conversation

likebreath
Copy link
Member

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: 3793ffe

Reported-by: Yi Wang foxywang@tencent.com

Copy link
Contributor

@up2wing up2wing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rbradford
Copy link
Member

The code is fine but this isn't a race - this is a deadlock and the commit message summary should cover that.

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: cloud-hypervisor@3793ffe

Reported-by: Yi Wang <foxywang@tencent.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
@likebreath likebreath force-pushed the 1016/tdx_fix_vm_config_deadlock branch from 368d8ff to a35072e Compare October 17, 2023 15:58
@likebreath likebreath changed the title vmm: tdx: Fix a race condition while accessing vm_config vmm: tdx: Fix a deadlock while accessing vm_config Oct 17, 2023
@likebreath
Copy link
Member Author

The code is fine but this isn't a race - this is a deadlock and the commit message summary should cover that.

Right. There are no racing between threads, just a deadlock from one thread. PR updated.

@rbradford rbradford enabled auto-merge (rebase) October 17, 2023 16:43
@rbradford rbradford merged commit aa6e831 into cloud-hypervisor:main Oct 17, 2023
22 checks passed
@likebreath likebreath added the bug Something isn't working label Oct 18, 2023
@likebreath likebreath added bug-fix Bug fix to include in release notes and removed bug Something isn't working labels Nov 1, 2023
russell-islam pushed a commit to microsoft/cloud-hypervisor that referenced this pull request Apr 12, 2024
v36.0

This release has been tracked in our [roadmap
project](https://github.com/orgs/cloud-hypervisor/projects/6) as iteration
v36.0. The following user visible changes have been made:

Command Line Changes
--------------------

We switched back to use the `clap` crate to create our command line,
since the `argh` crate is barely maintained. There were several syntax
changes:

* All `--option value` commands now are `--option=value`.
* The `--disk DISK1 --disk DISK2` command now is `--disk DISK1 DISK2`.
* The `-v -v -v`command now is `-vvv`.

Note: the released binary size increased around 0.3M due to this change.

Enabled Features Reported via API Endpoint and CLI
--------------------------------------------------

Now the enabled (Cargo) features of the running Cloud Hypervisor
instance can be queried via API endpoint (`/vmm.ping`) and CLI
(`--version -v`).

NUMA Support for PCI segments
-----------------------------

The `--numa` command is augmented with a new option `pci_segment=`, so
that users can define the relationship between PCI segments and NUMA
nodes. Examples can be found from the [memory documentation](docs/memory.md)

CPU Topology Support on AMD Platforms
-------------------------------------

Now the CPU topology on x86_64 platforms supports multiple vendors.

Unix Socket Backend for Serial Port
-----------------------------------

The `--serial` command is augmented with a new option `socket=`, allowing
users to access the serial port using a Unix socket.

AIO Backend for Block Devices
-----------------------------

An AIO backend is added for `virtio-block` devices to improve block
device performance when the `io_uring` feature is not supported by the
host Operating System.

Documentation Improvements
--------------------------

* New [documentation](docs/coverage.md) for collecting coverage data
* Various typo fixes

Notable Bug Fixes
-----------------

* Fix a deadlock when TDX is enabled (cloud-hypervisor#5845)
* Only advertise AMX feature bits to guest when the AMX cpu feature is
  enabled (cloud-hypervisor#5834)
* Correct default value for vCPU topology on AArch64 (cloud-hypervisor#5893)

Contributors
------------

Many thanks to everyone who has contributed to our release:

*  Anatol Belski <anbelski@linux.microsoft.com>
*  Bo Chen <chen.bo@intel.com>
*  Dario Nieuwenhuis <dirbaio@dirbaio.net>
*  Jianyong Wu <jianyong.wu@arm.com>
*  Jinank Jain <jinankjain@microsoft.com>
*  Muminul Islam <muislam@microsoft.com>
*  Praveen K Paladugu <prapal@linux.microsoft.com>
*  Ravi kumar Veeramally <ravikumar.veeramally@intel.com>
*  Rob Bradford <rbradford@rivosinc.com>
*  Thomas Barrett <tbarrett@crusoeenergy.com>
*  Wei Liu <liuwe@microsoft.com>
*  Yi Wang <foxywang@tencent.com>
*  dom.song <dom.song@amperecomputing.com>

* tag 'v36.0': (432 commits)
  build: Release v36.0
  main: Add the '--serial socket=' option help information
  build: Bump zerocopy from 0.7.8 to 0.7.21
  build: Bump serde_json from 1.0.107 to 1.0.108 in /fuzz
  Jenkinsfile: Skip 'test_vfio' and 'test_vfio_user' on AMD workers
  scripts: Simplify the script for running bare-metal VFIO tests
  tests: Remove "test_vfio" from the bare-metal worker
  aarch64: fdt: Use more appropriate default value for topology
  build: Bump toml_edit from 0.19.8 to 0.19.15
  build: Bump MSRV to 1.66
  build: Bump winapi-util from 0.1.5 to 0.1.6
  scripts: Clear the toolchain environment variables for virtiofsd
  build: Bump futures-core from 0.3.28 to 0.3.29 in /fuzz
  virtio-devices, vmm: Update seccomp list
  build: Bump seccompiler from 0.3.0 to 0.4.0
  build: Bump zerocopy from 0.7.11 to 0.7.20 in /fuzz
  block: add copyright text to raw_async_aio.rs
  hypervisor: Add support for MMIO write emulation
  hypervisor: Add support MMIO read VMGEXIT
  hypervisor: Add support for legacy I/O port emulation
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Bug fix to include in release notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants