[PATCH RFC 08/12] Documentation: KVM: Add example for kvm->srcu in relation to mutex/lock
From: Ackerley Tng via B4 Relay
Date: Wed May 27 2026 - 11:38:07 EST
From: Ackerley Tng <ackerleytng@xxxxxxxxxx>
Add example of where vcpu->mutex and kvm->slots_lock are held while calling
synchronize_srcu(&kvm->srcu) to concretely show where the synchronization
primitives overlap.
Signed-off-by: Ackerley Tng <ackerleytng@xxxxxxxxxx>
---
Documentation/virt/kvm/locking.rst | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Documentation/virt/kvm/locking.rst b/Documentation/virt/kvm/locking.rst
index 437dbfa0030b9..f12664443e913 100644
--- a/Documentation/virt/kvm/locking.rst
+++ b/Documentation/virt/kvm/locking.rst
@@ -35,9 +35,12 @@ The acquisition orders for mutexes are as follows:
For SRCU:
- ``synchronize_srcu(&kvm->srcu)`` is called inside critical sections
- for vcpu->mutex and kvm->slots_lock. These locks _cannot_ be taken
- inside a kvm->srcu read-side critical section; that is, the
- following is broken::
+ for vcpu->mutex and kvm->slots_lock. (For example, when there is a
+ ``KVM_REQ_APICV_UPDATE`` request, ``vcpu->mutex`` is held in
+ ``kvm_vcpu_ioctl()``, and then when the memslots get updated,
+ ``kvm->slots_lock`` is taken.) These locks _cannot_ be taken inside
+ a kvm->srcu read-side critical section; that is, the following is
+ broken::
srcu_read_lock(&kvm->srcu);
mutex_lock(&kvm->slots_lock);
--
2.54.0.823.g6e5bcc1fc9-goog