Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-11 Thread Avi Kivity
Marcelo Tosatti wrote: On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: Marcelo Tosatti wrote: 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 noti

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-11 Thread Marcelo Tosatti
On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> 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

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-09 Thread Alexander Graf
On 09.01.2009, at 01:36, Marcelo Tosatti wrote: On Thu, Jan 08, 2009 at 08:53:21PM +0100, Alexander Graf wrote: Sorry for the late reply - I wanted to know who kvm hangs in the host kernel context :) On 07.01.2009, at 14:46, Marcelo Tosatti wrote: On Wed, Jan 07, 2009 at 01:32:41PM +02

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-08 Thread Marcelo Tosatti
On Thu, Jan 08, 2009 at 08:53:21PM +0100, Alexander Graf wrote: > Sorry for the late reply - I wanted to know who kvm hangs in the host > kernel context :) > > On 07.01.2009, at 14:46, Marcelo Tosatti wrote: > >> On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: >>> Marcelo Tosatti wro

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-08 Thread Alexander Graf
Sorry for the late reply - I wanted to know who kvm hangs in the host kernel context :) On 07.01.2009, at 14:46, Marcelo Tosatti wrote: On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: Marcelo Tosatti wrote: Let me shoot at one direction: a shadow page with PGE bit in either sta

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-07 Thread Marcelo Tosatti
On Wed, Jan 07, 2009 at 01:32:41PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> 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

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-07 Thread Avi Kivity
Marcelo Tosatti wrote: 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. --

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-07 Thread Marcelo Tosatti
On Wed, Jan 07, 2009 at 12:19:26PM +0200, Avi Kivity wrote: > Alexander Graf wrote: >> Using this patch it works. But if I read it correctly, that doesn't >> actually fix anything but only treats NPT/EPT special, which it >> shouldn't, should it? > > The patch doesn't fix the bug but is neverthele

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-07 Thread Avi Kivity
Alexander Graf wrote: Using this patch it works. But if I read it correctly, that doesn't actually fix anything but only treats NPT/EPT special, which it shouldn't, should it? The patch doesn't fix the bug but is nevertheless correct. cr4.pge only matters to the mmu if using the shadow mmu;

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Alexander Graf
Marcelo Tosatti wrote: > On Tue, Jan 06, 2009 at 04:29:59PM +0200, Avi Kivity wrote: > >> Yes... >> >> Looks like kvm_unsync_page can be folded into mmu_need_write_protect >> (after which we can drop lookup_page(), which is not a good API). But >> that's after we solve the current problem.

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2009 at 04:29:59PM +0200, Avi Kivity wrote: > Yes... > > Looks like kvm_unsync_page can be folded into mmu_need_write_protect > (after which we can drop lookup_page(), which is not a good API). But > that's after we solve the current problem. > > Looks like the addition of a se

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2009 at 04:29:59PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> On Tue, Jan 06, 2009 at 12:41:40PM +0200, Avi Kivity wrote: >> >>> Alexander Graf wrote: >>> Avi Kivity wrote: > From: Avi Kivity > > Don't allow a vcpu with cr4.pge clear

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Avi Kivity
Marcelo Tosatti wrote: On Tue, Jan 06, 2009 at 12:41:40PM +0200, Avi Kivity wrote: Alexander Graf wrote: Avi Kivity wrote: From: Avi Kivity 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 sync ptes

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Marcelo Tosatti
On Tue, Jan 06, 2009 at 12:41:40PM +0200, Avi Kivity wrote: > Alexander Graf wrote: >> Avi Kivity wrote: >> >>> From: Avi Kivity >>> >>> 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 sync ptes that have the >>> gl

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-06 Thread Avi Kivity
Alexander Graf wrote: Avi Kivity wrote: From: Avi Kivity 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 sync ptes that have the global bit set (the global bit has no effect if !cr4.pge). This can only occur on smp

Re: [PATCH] KVM: MMU: Segregate mmu pages created with different cr4.pge settings

2009-01-05 Thread Alexander Graf
Avi Kivity wrote: > From: Avi Kivity > > 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 sync ptes that have the > global bit set (the global bit has no effect if !cr4.pge). > > This can only occur on smp with different