swap: fix deadlock on the vmm-swap enable operation

The deadlock could happen on this scenario:

1. User enables vmm-swap. The main process sends Command::Enable to the
   monitor process.
2. User request the current status at the same time. The main process
   sends Command::Status to the monitor process and wait for the
   response from the monitor process.
3. The monitor process start enabling vmm-swap. Sends
   VmSwapCommand::Suspend to the main process and wait for
   VmSwapResponse::SuspendCompleted.
4. The main process is blocked by the step 2 and the request from step 3
   is never consumed.

The root issue issue is that Command::Status can be inserted between
Command::Enable and VmSwapCommand::Suspend. This CL simplifies the
communication between the main and monitor processes on enabling
vmm-swap and resolve the deadlock.

VmSwapCommand and corresponding Tube was added by
https://crrev.com/c/4293656, but is now removed by this CL.

BUG=b:275671628
TEST=manual test

Change-Id: Ia838b1feddb4a3f41bd729e9147adc5e2df866aa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4387662
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
4 files changed
tree: 3ec6be0d664633e7ed50eb684c715b64f0a1f230
  1. .cargo/
  2. .config/
  3. .devcontainer/
  4. .github/
  5. .vscode/
  6. aarch64/
  7. acpi_tables/
  8. anti_tamper/
  9. arch/
  10. argh_helpers/
  11. audio_util/
  12. base/
  13. bit_field/
  14. broker_ipc/
  15. common/
  16. crash_report/
  17. cros_async/
  18. cros_fdt/
  19. cros_tracing/
  20. crosvm-fuzz/
  21. crosvm_cli/
  22. crosvm_control/
  23. crosvm_plugin/
  24. devices/
  25. disk/
  26. docs/
  27. e2e_tests/
  28. fuse/
  29. gpu_display/
  30. hypervisor/
  31. infra/
  32. io_uring/
  33. jail/
  34. kernel_cmdline/
  35. kernel_loader/
  36. kvm/
  37. kvm_sys/
  38. libcras_stub/
  39. linux_input_sys/
  40. logo/
  41. media/
  42. metrics/
  43. net_sys/
  44. net_util/
  45. power_monitor/
  46. prebuilts/
  47. proto_build_tools/
  48. protos/
  49. qcow_utils/
  50. resources/
  51. rutabaga_gfx/
  52. sandbox/
  53. serde_keyvalue/
  54. src/
  55. swap/
  56. system_api/
  57. tests/
  58. third_party/
  59. tools/
  60. tpm2/
  61. tpm2-sys/
  62. tube_transporter/
  63. usb_sys/
  64. usb_util/
  65. vfio_sys/
  66. vhost/
  67. virtio_sys/
  68. vm_control/
  69. vm_memory/
  70. win_audio/
  71. win_util/
  72. x86_64/
  73. .dockerignore
  74. .envrc
  75. .gitignore
  76. .gitmodules
  77. .rustfmt.toml
  78. ARCHITECTURE.md
  79. Cargo.lock
  80. Cargo.toml
  81. CONTRIBUTING.md
  82. DIR_METADATA
  83. LICENSE
  84. mypy.ini
  85. OWNERS
  86. OWNERS_COUNCIL
  87. PRESUBMIT.cfg
  88. pyproject.toml
  89. README.chromeos.md
  90. README.md
  91. rust-toolchain
README.md

crosvm - The ChromeOS Virtual Machine Monitor

crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the ChromeOS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.

crosvm is currently used to run Linux/Android guests on ChromeOS devices.

Logo