diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2008-06-11 20:32:40 -0300 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-06-24 12:18:18 +0300 |
commit | 3094538739415a9225afd2a6c78cb0fe1c1f641b (patch) | |
tree | b6f4b62812fd55ffa60d4383af1e7079e8b29a30 /arch/x86 | |
parent | 6597ca09e6c0e5aec7ffd2b8ab48c671d3c28414 (diff) | |
download | blackbird-op-linux-3094538739415a9225afd2a6c78cb0fe1c1f641b.tar.gz blackbird-op-linux-3094538739415a9225afd2a6c78cb0fe1c1f641b.zip |
KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend)
kvm_mmu_pte_write() does not handle 32-bit non-PAE large page backed
guests properly. It will instantiate two 2MB sptes pointing to the same
physical 2MB page when a guest large pte update is trapped.
Instead of duplicating code to handle this, disallow directory level
updates to happen through kvm_mmu_pte_write(), so the two 2MB sptes
emulating one guest 4MB pte can be correctly created by the page fault
handling path.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kvm/mmu.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 9628091c574d..baa6503894d3 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1581,11 +1581,13 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu, u64 *spte, const void *new) { - if ((sp->role.level != PT_PAGE_TABLE_LEVEL) - && !vcpu->arch.update_pte.largepage) { - ++vcpu->kvm->stat.mmu_pde_zapped; - return; - } + if (sp->role.level != PT_PAGE_TABLE_LEVEL) { + if (!vcpu->arch.update_pte.largepage || + sp->role.glevels == PT32_ROOT_LEVEL) { + ++vcpu->kvm->stat.mmu_pde_zapped; + return; + } + } ++vcpu->kvm->stat.mmu_pte_updated; if (sp->role.glevels == PT32_ROOT_LEVEL) |