From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] KVM: Start lock documentation Date: Wed, 09 Feb 2011 15:18:09 +0100 Message-ID: <4D52A221.9070702@siemens.com> References: <4D52A090.5010308@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , kvm To: Zachary Amsden Return-path: Received: from thoth.sbs.de ([192.35.17.2]:25695 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755755Ab1BIOSV (ORCPT ); Wed, 9 Feb 2011 09:18:21 -0500 In-Reply-To: <4D52A090.5010308@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2011-02-09 15:11, Jan Kiszka wrote: > The goal of this document shall be > - overview of all locks used in KVM core > - provide details on the scope of each lock > - explain the lock type, specifically of a raw spin locks > - provide a lock ordering guide > > Start with one dependency chain and two locks. > > Signed-off-by: Jan Kiszka > --- > Documentation/kvm/locking.txt | 30 ++++++++++++++++++++++++++++++ > 1 files changed, 30 insertions(+), 0 deletions(-) > create mode 100644 Documentation/kvm/locking.txt > > diff --git a/Documentation/kvm/locking.txt b/Documentation/kvm/locking.txt > new file mode 100644 > index 0000000..23f9092 > --- /dev/null > +++ b/Documentation/kvm/locking.txt > @@ -0,0 +1,30 @@ > +KVM Lock Overview > +================= > + > +1. Acquisition Orders > +--------------------- > + > +kvm_lock > ++-> kvm::srcu / kvm::lock > + +-> kvm::slots_lock > + +-> kvm::mmu_lock > +... > + > + > +2. Reference > +------------ > + > +Name: kvm_lock > +Type: raw_spinlock > +Arch: any > +Protects: - vm_list > + - hardware virtualization enable/disable > +Comment: 'raw' because hardware enabling/disabling must be atomic /wrt > + migration. > + > +Name: kvm_arch::tsc_write_lock > +Type: raw_spinlock > +Arch: x86 > +Protects: - kvm_arch::{last_tsc_write,last_tsc_nsec,last_tsc_offset} > + - tsc offset in vmcb > +Comment: 'raw' because updating the tsc offsets must not be preempted. Sorry, Zach, you should likely have a look at this as well. Jan -- Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux