Re: [PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Avi Kivity
On 04/13/2010 06:07 AM, Xiao Guangrong wrote: And i found the commit 87778d60ee: |KVM: MMU: Segregate mmu pages created with different cr4.pge settings | |Don't allow a vcpu with cr4.pge cleared to use a shadow page created with |cr4.pge set; this might cause a cr3 switch not to syn

Re: [PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Xiao Guangrong
Avi Kivity wrote: > See 6364a3918cb. It was reverted later due to a problem with the > implementation. I'm not sure whether I want to fix the bug and restore > that patch, or to drop it altogether and give the guest ownership of > cr4.pge. See cr4_guest_owned_bits (currently only used on ept)

Re: [PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Avi Kivity
On 04/12/2010 01:42 PM, Xiao Guangrong wrote: Hi Avi, Thanks for your comments. Avi Kivity wrote: Later we have: kvm_x86_ops->set_cr4(vcpu, cr4); vcpu->arch.cr4 = cr4; vcpu->arch.mmu.base_role.cr4_pge = (cr4& X86_CR4_PGE)&& !tdp_enabled; All of

Re: [PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Xiao Guangrong
Hi Avi, Thanks for your comments. Avi Kivity wrote: > Later we have: > >> kvm_x86_ops->set_cr4(vcpu, cr4); >> vcpu->arch.cr4 = cr4; >> vcpu->arch.mmu.base_role.cr4_pge = (cr4 & X86_CR4_PGE) && >> !tdp_enabled; > > All of which depend on cr4. Oh, destroy_kvm_mmu() is no

Re: [PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Avi Kivity
On 04/12/2010 11:03 AM, Xiao Guangrong wrote: Usually, OS changes CR4.PGE bit to flush all global page, under this case, no need reset mmu and just flush tlb Signed-off-by: Xiao Guangrong --- arch/x86/kvm/x86.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/a

[PATCH 4/6] KVM MMU: optimize for writing cr4

2010-04-12 Thread Xiao Guangrong
Usually, OS changes CR4.PGE bit to flush all global page, under this case, no need reset mmu and just flush tlb Signed-off-by: Xiao Guangrong --- arch/x86/kvm/x86.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index fd5c