linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: document lock orders
@ 2016-10-13 11:10 Paolo Bonzini
  2016-10-13 12:51 ` Radim Krčmář
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2016-10-13 11:10 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: rkrcmar

This is long overdue, and not really hard.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Documentation/virtual/kvm/locking.txt | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/virtual/kvm/locking.txt b/Documentation/virtual/kvm/locking.txt
index f2491a8c68b4..e5dd9f4d6100 100644
--- a/Documentation/virtual/kvm/locking.txt
+++ b/Documentation/virtual/kvm/locking.txt
@@ -4,7 +4,17 @@ KVM Lock Overview
 1. Acquisition Orders
 ---------------------
 
-(to be written)
+The acquisition orders for mutexes are as follows:
+
+- kvm->lock is taken outside vcpu->mutex
+
+- kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock
+
+- kvm->slots_lock is taken outside kvm->irq_lock, though acquiring
+  them together is quite rare.
+
+For spinlocks, kvm_lock is taken outside kvm->mmu_lock.  Everything
+else is a leaf: no other lock is taken inside the critical sections.
 
 2: Exception
 ------------
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: document lock orders
  2016-10-13 11:10 [PATCH] KVM: document lock orders Paolo Bonzini
@ 2016-10-13 12:51 ` Radim Krčmář
  0 siblings, 0 replies; 2+ messages in thread
From: Radim Krčmář @ 2016-10-13 12:51 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: linux-kernel, kvm

2016-10-13 13:10+0200, Paolo Bonzini:
> This is long overdue, and not really hard.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

Applied to kvm/queue, thanks.

>  Documentation/virtual/kvm/locking.txt | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/virtual/kvm/locking.txt b/Documentation/virtual/kvm/locking.txt
> index f2491a8c68b4..e5dd9f4d6100 100644
> --- a/Documentation/virtual/kvm/locking.txt
> +++ b/Documentation/virtual/kvm/locking.txt
> @@ -4,7 +4,17 @@ KVM Lock Overview
>  1. Acquisition Orders
>  ---------------------
>  
> -(to be written)
> +The acquisition orders for mutexes are as follows:
> +
> +- kvm->lock is taken outside vcpu->mutex
> +
> +- kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock
> +
> +- kvm->slots_lock is taken outside kvm->irq_lock, though acquiring
> +  them together is quite rare.
> +
> +For spinlocks, kvm_lock is taken outside kvm->mmu_lock.  Everything
> +else is a leaf: no other lock is taken inside the critical sections.
>  
>  2: Exception
>  ------------
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-10-13 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13 11:10 [PATCH] KVM: document lock orders Paolo Bonzini
2016-10-13 12:51 ` Radim Krčmář

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).