From: Joerg Roedel <joerg.roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
Alexander Graf <agraf@suse.de>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/18] KVM: MMU: Make tdp_enabled a mmu-context parameter
Date: Wed, 10 Mar 2010 16:26:43 +0100 [thread overview]
Message-ID: <20100310152643.GO5619@amd.com> (raw)
In-Reply-To: <4B97B269.3010502@redhat.com>
On Wed, Mar 10, 2010 at 04:53:29PM +0200, Avi Kivity wrote:
> On 03/10/2010 04:44 PM, Joerg Roedel wrote:
> >On Mon, Mar 08, 2010 at 11:17:41AM +0200, Avi Kivity wrote:
> >>On 03/03/2010 09:12 PM, Joerg Roedel wrote:
> >>>This patch changes the tdp_enabled flag from its global
> >>>meaning to the mmu-context. This is necessary for Nested SVM
> >>>with emulation of Nested Paging where we need an extra MMU
> >>>context to shadow the Nested Nested Page Table.
> >>>
> >>>
> >>>diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> >>>index ec891a2..e7bef19 100644
> >>>--- a/arch/x86/include/asm/kvm_host.h
> >>>+++ b/arch/x86/include/asm/kvm_host.h
> >>>@@ -254,6 +254,7 @@ struct kvm_mmu {
> >>> int root_level;
> >>> int shadow_root_level;
> >>> union kvm_mmu_page_role base_role;
> >>>+ bool tdp_enabled;
> >>>
> >>This needs a different name, since the old one is still around.
> >>Perhaps we could call it parent_mmu and make it a kvm_mmu pointer.
> >Hmm, how about renaming the global tdp_enabled variable to tdp_usable?
> >The global variable indicates if tdp is _usable_ and we can _enable_ it
> >for a mmu context.
>
> I think of the global flags as host tdp, and the mmu as guest tdp
> (but maybe this is wrong?). If that makes sense, the naming should
> reflect that.
The basic flow of the mmu state with npt-npt is:
1. As long as the L1 is running the arch.mmu context is in tdp
mode and builds a direct-mapped page table.
2. When vmrun is emulated and the nested vmcb enables nested
paging, arch.mmu is switched to a shadow-mmu mode which now
shadows the l1 nested page table.
So when the l2-guest runs with nested paging the
arch.mmu.tdp_enabled variable on the host is false.
3. On a vmexit emulation the mmu is switched back to tdp
handling state.
So the mmu.tdp_enabled parameter is about tdp being enabled for the
mmu context (so mmu.tdp_enabled means that we build a l1-direct-mapped
page table when true or shadow a l1-page-table when false). Thats why I
think the 'tdp_enabled' name makes sense in the mmu-context.
The global flag only shows if an mmu-context could be in tdp-state. So
tdp_usable may be a good name for it.
Joerg
next prev parent reply other threads:[~2010-03-10 15:27 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-03 19:12 [PATCH 0/18][RFC] Nested Paging support for Nested SVM (aka NPT-Virtualization) Joerg Roedel
2010-03-03 19:12 ` [PATCH 01/18] KVM: MMU: Check for root_level instead of long mode Joerg Roedel
2010-03-03 19:12 ` [PATCH 02/18] KVM: MMU: Make tdp_enabled a mmu-context parameter Joerg Roedel
2010-03-08 9:17 ` Avi Kivity
2010-03-10 14:44 ` Joerg Roedel
2010-03-10 14:53 ` Avi Kivity
2010-03-10 15:26 ` Joerg Roedel [this message]
2010-03-11 6:47 ` Avi Kivity
2010-03-11 10:33 ` Joerg Roedel
2010-03-03 19:12 ` [PATCH 03/18] KVM: MMU: Make set_cr3 a function pointer in kvm_mmu Joerg Roedel
2010-03-03 19:12 ` [PATCH 04/18] KVM: X86: Introduce a tdp_set_cr3 function Joerg Roedel
2010-03-03 19:12 ` [PATCH 05/18] KVM: MMU: Introduce get_cr3 function pointer Joerg Roedel
2010-03-03 19:12 ` [PATCH 06/18] KVM: MMU: Introduce inject_page_fault " Joerg Roedel
2010-03-03 19:12 ` [PATCH 07/18] KVM: SVM: Implement MMU helper functions for Nested Nested Paging Joerg Roedel
2010-03-03 19:12 ` [PATCH 08/18] KVM: MMU: Change init_kvm_softmmu to take a context as parameter Joerg Roedel
2010-03-03 19:12 ` [PATCH 09/18] KVM: MMU: Let is_rsvd_bits_set take mmu context instead of vcpu Joerg Roedel
2010-03-03 19:12 ` [PATCH 10/18] KVM: MMU: Introduce generic walk_addr function Joerg Roedel
2010-03-03 19:12 ` [PATCH 11/18] KVM: MMU: Add infrastructure for two-level page walker Joerg Roedel
2010-03-08 9:37 ` Avi Kivity
2010-03-10 14:46 ` Joerg Roedel
2010-03-03 19:12 ` [PATCH 12/18] KVM: MMU: Implement nested gva_to_gpa functions Joerg Roedel
2010-03-03 19:12 ` [PATCH 13/18] KVM: MMU: Introduce Nested MMU context Joerg Roedel
2010-03-03 19:12 ` [PATCH 14/18] KVM: SVM: Initialize Nested Nested MMU context on VMRUN Joerg Roedel
2010-03-03 19:12 ` [PATCH 15/18] KVM: MMU: Propagate the right fault back to the guest after gva_to_gpa Joerg Roedel
2010-03-15 4:30 ` Daniel K.
2010-03-15 12:52 ` Joerg Roedel
2010-03-15 7:36 ` Avi Kivity
2010-03-15 9:06 ` Joerg Roedel
2010-03-15 9:23 ` Avi Kivity
2010-03-15 9:41 ` Joerg Roedel
2010-03-03 19:12 ` [PATCH 16/18] KVM: X86: Add callback to let modules decide over some supported cpuid bits Joerg Roedel
2010-03-03 19:12 ` [PATCH 17/18] KVM: SVM: Report Nested Paging support to userspace Joerg Roedel
2010-03-03 23:37 ` Alexander Graf
2010-03-04 11:27 ` Joerg Roedel
2010-03-03 19:12 ` [PATCH 18/18] KVM: X86: Add KVM_CAP_SVM_CPUID_FIXED Joerg Roedel
2010-03-08 9:39 ` Avi Kivity
2010-03-10 14:46 ` Joerg Roedel
2010-03-03 23:10 ` [PATCH 0/18][RFC] Nested Paging support for Nested SVM (aka NPT-Virtualization) Jan Kiszka
2010-03-03 23:44 ` Alexander Graf
2010-03-04 11:29 ` Joerg Roedel
2010-03-04 0:35 ` Anthony Liguori
2010-03-04 14:42 ` Marcelo Tosatti
2010-03-04 15:58 ` Joerg Roedel
2010-03-11 20:58 ` Marcelo Tosatti
2010-03-12 7:36 ` Avi Kivity
2010-03-15 6:27 ` Marcelo Tosatti
2010-03-15 7:34 ` Avi Kivity
2010-03-12 7:41 ` Avi Kivity
2010-03-08 9:41 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100310152643.GO5619@amd.com \
--to=joerg.roedel@amd.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.