KVM: MMU: Segregate mmu pages created with different cr4.pge settings
Quoted 7 lines · Avi Kivity
Quoted 3 lines · Marcelo Tosatti
Let me shoot at one direction: a shadow page with PGE bit in either state is created. Later that shadow page is nuked (via mmu notifiers, for example).
I doubt that mmu notifiers were invoked in this case (the bug would be very rare); in any case we flush the tlb.
There are other events that zap shadow pages. Anyway, someone else should figure why NPT dislikes duplicate shadow page tables for the same address space. How about this, untested:
KVM: MMU: zero base_role on TDP mmu context initialization
A recent change which propagates CR4.PGE to shadow page roles broke NPT, perhaps due to the allocation of duplicate shadow trees for the same address space (actual details unknown).
In the meantime, since guest CR4.PGE is controlled by HW with NPT, and the relevant role information for TDP is passed directly to kvm_mmu_get_page, zero base_role on TDP mmu context init.
arch/x86/kvm/mmu.c +2 -0
@@ -2231,6 +2231,8 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) context->root_level =PT32_ROOT_LEVEL ; } + vcpu->arch.mmu.base_role =0 ; +return 0 ; }
Quoted 32 lines · Marcelo Tosatti
Quoted 8 lines · Avi Kivity
Quoted 4 lines · Marcelo Tosatti
Let me shoot at one direction: a shadow page with PGE bit in either state is created. Later that shadow page is nuked (via mmu notifiers, for example).
I doubt that mmu notifiers were invoked in this case (the bug would be very rare); in any case we flush the tlb.
There are other events that zap shadow pages. Anyway, someone else
should figure why NPT dislikes duplicate shadow page tables for the same address space. How about this, untested:KVM: MMU: zero
base_roleon TDP mmu context initializationA recent change which propagates CR4.PGE to shadow page roles broke NPT, perhaps due to the allocation of duplicate shadow trees for the same address space (actual details unknown).
In the meantime, since guest CR4.PGE is controlled by HW with NPT, and the relevant role information for TDP is passed directly to
kvm_mmu_get_page, zerobase_roleon TDP mmu context init.Signed-off-by Marcelo Tosatti <[email protected]>arch/x86/kvm/mmu.c +0
-0
arch/x86/kvm/mmu.c static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) · line 2238
Quoted 8 lines
arch/x86/kvm/mmu.c +2
-0@@ -2231,6 +2231,8 @@ static int init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) context->root_level =PT32_ROOT_LEVEL ; } + vcpu->arch.mmu.base_role =0 ; +return 0 ; }
Won't even compile, will it?
Signature · 1 line
error compiling committee.c: too many arguments to function