Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755316AbcJMMvO (ORCPT ); Thu, 13 Oct 2016 08:51:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932162AbcJMMvH (ORCPT ); Thu, 13 Oct 2016 08:51:07 -0400 Date: Thu, 13 Oct 2016 14:51:04 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH] KVM: document lock orders Message-ID: <20161013125103.GF16406@potion> References: <1476357057-17899-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476357057-17899-1-git-send-email-pbonzini@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 13 Oct 2016 12:51:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1107 Lines: 37 2016-10-13 13:10+0200, Paolo Bonzini: > This is long overdue, and not really hard. > > Signed-off-by: Paolo Bonzini > --- 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 >