From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 0/18][RFC] Nested Paging support for Nested SVM (aka NPT-Virtualization) Date: Mon, 15 Mar 2010 09:34:23 +0200 Message-ID: <4B9DE2FF.4080909@redhat.com> References: <1267643541-451-1-git-send-email-joerg.roedel@amd.com> <20100304144255.GA26657@amt.cnet> <20100304155820.GA6019@amd.com> <20100311205803.GA18849@amt.cnet> <4B99EF09.1080608@redhat.com> <20100315062721.GA3654@amt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Joerg Roedel , Alexander Graf , kvm@vger.kernel.org, linux-kernel@vger.kernel.org To: Marcelo Tosatti Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54554 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752025Ab0COHea (ORCPT ); Mon, 15 Mar 2010 03:34:30 -0400 In-Reply-To: <20100315062721.GA3654@amt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: On 03/15/2010 08:27 AM, Marcelo Tosatti wrote: >> >>> You should disable out of sync shadow so that l1 guest writes to >>> l1-nested-ptables always trap. >>> >> Why? The guest is under obligation to flush the tlb if it writes to >> a page table, and we will resync on that tlb flush. >> > The guests hypervisor will not flush the tlb with invlpg for updates of > its NPT pagetables. It'll create a new ASID, and KVM will not trap > that. > We'll get a kvm_set_cr3() on the next vmrun. >>> And in the trap case, you'd have to >>> invalidate l2 shadow pagetable entries that used the (now obsolete) >>> l1-nested-ptable entry. Does that happen automatically? >>> >> What do you mean by 'l2 shadow ptable entries'? There are the >> guest's page tables (ordinary direct mapped, unless the guest's >> guest is also running an npt-enabled hypervisor), and the host page >> tables. When the guest writes to each page table, we invalidate the >> shadows. >> > With 'l2 shadow ptable entries' i mean the shadow pagetables that > translate GPA-L2 -> HPA. > kvm_mmu_pte_write() will invalidate those sptes and will also install new translations if possible. Beautiful, isn't it? -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.