From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: Nested Page Faults Date: Sat, 15 May 2010 16:41:12 +0200 Message-ID: <20100515144112.GA19442@8bytes.org> References: <95896DAD-AA56-4346-8B2B-5117E6B895DA@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Matteo Signorini , kvm@vger.kernel.org To: Alexander Graf Return-path: Received: from 8bytes.org ([88.198.83.132]:35766 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753240Ab0EOOlO (ORCPT ); Sat, 15 May 2010 10:41:14 -0400 Content-Disposition: inline In-Reply-To: <95896DAD-AA56-4346-8B2B-5117E6B895DA@suse.de> Sender: kvm-owner@vger.kernel.org List-ID: On Fri, May 14, 2010 at 04:26:11PM +0200, Alexander Graf wrote: > > On 14.05.2010, at 15:15, Matteo Signorini wrote: > > > Hi to all, > > > > I am working on NPT and have some doubts. > > Please correct me if I am wrong, > > > > In NPT only the first time a page fault happens it is trapped by the host. > > The following page faults are not trapped by the host in order to > > reduce page walk overhead. > > > > My question is... > > > > Which Kvm function handles the "nested page fault"? > > The exit code is SVM_EXIT_NPF. Just search for the handler in svm.c:svm_exit_handlers. > > [SVM_EXIT_NPF] = pf_interception, Which ends up in tdp_page_fault(). This function calls the generic __direct_map() handler (that is used for real-mode paging too). Note that nested page faults are different from guest page faults. Guest page faults occur for guest virtual addresses (and are handled entirely inside the guest most of the time) while nested page faults occur for guest physical addresses and are alway handled by kvm. Joerg