crosvm/crosvm_cli
Daniel Verkamp 809b1a718c devices: vfio: make global container state explicit
The vfio code previously managed singleton instances of VfioContainer
using thread-local variables hidden inside the implementation of
vfio_get_container().

Make the caller hold onto a VfioContainerManager rather than implicitly
mutating global state inside a library function in the vfio crate. This
also removes the possibility of accidentally creating new VfioContainer
instances by calling from a different thread, since the containers were
previously thread-local rather than truly global for some reason.

This requires threading the vfio_container_manager variable through a
few function calls, but this also helps clarify ownership and lifetime
of the objects involved.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I2ba1be561c48143ff14e391c23bad1c6783b73ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5601348
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
2024-06-06 23:31:16 +00:00
..
src devices: vfio: make global container state explicit 2024-06-06 23:31:16 +00:00
Cargo.toml Cargo.toml: avoid "*" versions for external crates 2024-05-22 01:01:42 +00:00