* KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend)
@ 2008-06-11 23:32 Marcelo Tosatti
2008-06-12 11:59 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Tosatti @ 2008-06-11 23:32 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
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>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index c5def36..3ee3a6c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1586,11 +1587,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)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend)
2008-06-11 23:32 KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend) Marcelo Tosatti
@ 2008-06-12 11:59 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-06-12 11:59 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: kvm-devel
Marcelo Tosatti wrote:
> 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.
>
>
Applied, thanks.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-12 12:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-11 23:32 KVM: MMU: large page update_pte issue with non-PAE 32-bit guests (resend) Marcelo Tosatti
2008-06-12 11:59 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox