From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 2/6] kvm.git allow reading aliases with mmu_lock Date: Mon, 28 Jul 2008 18:43:47 -0300 Message-ID: <20080728214347.GA11486@dmt.cnet> References: <20080725142452.GA8217@duo.random> <20080725142639.GB8217@duo.random> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Marcelo Tosatti , kvm@vger.kernel.org To: Andrea Arcangeli Return-path: Received: from mx1.redhat.com ([66.187.233.31]:60641 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751561AbYG1VqX (ORCPT ); Mon, 28 Jul 2008 17:46:23 -0400 Content-Disposition: inline In-Reply-To: <20080725142639.GB8217@duo.random> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, Jul 25, 2008 at 04:26:39PM +0200, Andrea Arcangeli wrote: > This allows the mmu notifier code to run unalias_gfn with only the > mmu_lock held. Only alias writes need the mmu_lock held. Readers will > either take the slots_lock in read mode or the mmu_lock. > > Signed-off-by: Andrea Arcangeli > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index f7726a0..ddaf960 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1515,6 +1515,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, > goto out; > > down_write(&kvm->slots_lock); > + spin_lock(&kvm->mmu_lock); > > p = &kvm->arch.aliases[alias->slot]; > p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT; > @@ -1526,6 +1527,7 @@ static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm, > break; > kvm->arch.naliases = n; > > + spin_unlock(&kvm->mmu_lock); > kvm_mmu_zap_all(kvm); > > up_write(&kvm->slots_lock); > -- Looks good.