virtio: video: Increase command queue size

The queue size defines the number of available descriptors, that can be
used for exchanging messages between guest and hypervisor. Each
virtio-video command uses at least 1 descriptor (eg. CMD_QUEUE uses 2).
The amount of descriptors in use depends on the number of sessions and
buffers in input and output video queue.
In the worst case scenario the peak number can reach over 672 for 8
simultaneous streams, with 26 + 16 buffers each just for CMD_QUEUE
commands alone.

If the entire queue is overfilled with CMD_QUEUE for OUTPUT queue only,
the driver has no free descriptors for INPUT queue buffers. This leads
to encoder/decoder starvation, hence no OUTPUT buffer can be produced
and no CMD_QUEUE will finish, which leads to dead locking the device.

This patch increases the queue size with consideration of above details
with some headroom to avoid driver's deadlock.

BUG=b:204055006
TEST=App from https://github.com/chromeos/video-decode-encode-demo.git
with 8 simultaneous stream runs without blocking the device.

Change-Id: If51e340dd501b5b261518fba23fc541e3b55af8a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3606869
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Emilie Roberts <hadrosaur@google.com>
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Marcin Wojtas <mwojtas@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
1 file changed
tree: ba1c33f087b20907655b4616f8d88a3baf7f1dff
  1. .cargo/
  2. .devcontainer/
  3. .github/
  4. aarch64/
  5. acpi_tables/
  6. arch/
  7. base/
  8. bin/
  9. bit_field/
  10. ci/
  11. common/
  12. cros_async/
  13. crosvm-fuzz/
  14. crosvm_control/
  15. crosvm_plugin/
  16. devices/
  17. disk/
  18. docs/
  19. fuse/
  20. gpu_display/
  21. hypervisor/
  22. infra/
  23. integration_tests/
  24. io_uring/
  25. kernel_cmdline/
  26. kernel_loader/
  27. kvm/
  28. kvm_sys/
  29. libcras_stub/
  30. linux_input_sys/
  31. logo/
  32. media/
  33. metrics/
  34. net_sys/
  35. net_util/
  36. power_monitor/
  37. protos/
  38. qcow_utils/
  39. resources/
  40. rutabaga_gfx/
  41. seccomp/
  42. serde_keyvalue/
  43. src/
  44. system_api_stub/
  45. tests/
  46. third_party/
  47. tools/
  48. tpm2/
  49. tpm2-sys/
  50. tube_transporter/
  51. usb_sys/
  52. usb_util/
  53. vfio_sys/
  54. vhost/
  55. virtio_sys/
  56. vm_control/
  57. vm_memory/
  58. win_util/
  59. x86_64/
  60. .dockerignore
  61. .gitignore
  62. .gitmodules
  63. .rustfmt.toml
  64. ARCHITECTURE.md
  65. Cargo.toml
  66. CONTRIBUTING.md
  67. LICENSE
  68. navbar.md
  69. OWNERS
  70. README.chromeos.md
  71. README.md
  72. run_tests
  73. rust-toolchain
  74. setup_cros_cargo.sh
  75. test_all
  76. unblocked_terms.txt
README.md

crosvm - The Chrome OS 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 Chrome OS 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 Chrome OS devices.

Logo