From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 2/5] KVM: MMU: allow pinning spte translations (TDP-only) Date: Thu, 19 Jun 2014 16:22:57 -0300 Message-ID: <20140619192257.GA5561@amt.cnet> References: <20140618231203.846608908@amt.cnet> <20140618231521.569025131@amt.cnet> <20140619072116.GC10948@minantech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, ak@linux.intel.com, pbonzini@redhat.com, xiaoguangrong@linux.vnet.ibm.com, avi@cloudius-systems.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44350 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757787AbaFSTXU (ORCPT ); Thu, 19 Jun 2014 15:23:20 -0400 Content-Disposition: inline In-Reply-To: <20140619072116.GC10948@minantech.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jun 19, 2014 at 10:21:16AM +0300, Gleb Natapov wrote: > On Wed, Jun 18, 2014 at 08:12:05PM -0300, mtosatti@redhat.com wrote: > > Allow vcpus to pin spte translations by: > > > > 1) Creating a per-vcpu list of pinned ranges. > What if memory slot containing pinned range is going away? ->page_fault() should fail and guest abort. Will double check. > > 2) On mmu reload request: > > - Fault ranges. > > - Mark sptes with a pinned bit. > Should also be marked "dirty" as per SDM: > The three DS save area sections should be allocated from a non-paged pool, and marked accessed and dirty This (SDM text) is about guest pagetable AFAICS. > > + mutex_unlock(&vcpu->arch.pinned_mmu_mutex); > > + > > + if (vcpu->arch.nr_pinned_ranges >= > > + KVM_MAX_PER_VCPU_PINNED_RANGE) > > + return -ENOSPC; > Shouldn't we refuse to register pinned range if !TDP? Sure. > > + /* MMU notifier sequence window: retry */ > > + if (!r && !pinned) > > + kvm_make_request(KVM_REQ_MMU_RELOAD, vcpu); > > + if (r) { > > + kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); > I do not think triple fault is appropriate here. The reasons for triple fault are > documented in SDM and this is not one of them. What about error exit to user space? Agree, will change.