Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1500178 > unrolled thread

[PATCH] KVM: document lock orders

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-10-13 13:20 +0200
Last post2016-10-13 15:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] KVM: document lock orders Paolo Bonzini <pbonzini@redhat.com> - 2016-10-13 13:20 +0200
    Re: [PATCH] KVM: document lock orders Radim Krčmář <rkrcmar@redhat.com> - 2016-10-13 15:00 +0200

#1500178 — [PATCH] KVM: document lock orders

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-10-13 13:20 +0200
Subject[PATCH] KVM: document lock orders
Message-ID<srMdk-2NV-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1500253

FromRadim Krčmář <rkrcmar@redhat.com>
Date2016-10-13 15:00 +0200
Message-ID<srNMa-3Dq-13@gated-at.bofh.it>
In reply to#1500178
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
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web