From: Marcelo Tosatti Subject: Re: [PATCH] KVM: MMU: Don't read pdptrs with mmu spinlock held in mmu_alloc_roots Date: Thu, 6 May 2010 16:10:55 -0300 Message-ID: <20100506191055.GB3432@amt.cnet> References: <1272967430-6191-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Joerg Roedel To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758034Ab0EFULS (ORCPT ); Thu, 6 May 2010 16:11:18 -0400 Content-Disposition: inline In-Reply-To: <1272967430-6191-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, May 04, 2010 at 01:03:50PM +0300, Avi Kivity wrote: > On svm, kvm_read_pdptr() may require reading guest memory, which can sleep. > > Push the spinlock into mmu_alloc_roots(), and only take it after we've read > the pdptr. > > Signed-off-by: Avi Kivity > --- > > Marcelo, dropping and re-acquiring the lock before mmu_sync_roots(), is fine, > yes? Yes, but you should call kvm_mmu_free_some_pages after reacquiring the spin_lock, to guarantee kvm_mmu_alloc_page won't fail.