HomeFreeBSD

vmm: Use an sx lock to protect the memory map.

Description

vmm: Use an sx lock to protect the memory map.

Previously bhyve obtained a "read lock" on the memory map for ioctls
needing to read the map by locking the last vCPU. This is now
replaced by a new per-VM sx lock. Modifying the map requires
exclusively locking the sx lock as well as locking all existing vCPUs.
Reading the map requires either locking one vCPU or the sx lock.

This permits safely modifying or querying the memory map while some
vCPUs do not exist which will be true in a future commit.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37172

(cherry picked from commit 67b69e76e8eecfd204f6de636d622a1d681c8d7e)

Details

Provenance
jhbAuthored on Nov 18 2022, 6:04 PM
Reviewer
corvink
Differential Revision
D37172: vmm: Use an sx lock to protect the memory map.
Parents
rG1c44dd389459: vmm: Destroy mutexes.
Branches
Unknown
Tags
Unknown