Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-21 Thread Avi Kivity
Hollis Blanchard wrote: On Thu, 2008-07-10 at 20:49 -0300, Marcelo Tosatti wrote: diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index b850d24..2c438a7 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -170,6 +170,11 @@ int kvm_arch_set_memory_r

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-21 Thread Hollis Blanchard
On Monday 21 July 2008 16:34:40 Marcelo Tosatti wrote: > On Mon, Jul 21, 2008 at 04:03:27PM -0500, Hollis Blanchard wrote: > > > > By the way, what is the testcase for this, i.e. how do I remove a > > memslot? > > The testcase I used was RH6.2 graphical install, which changes the > cirrus mode fr

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-21 Thread Marcelo Tosatti
On Mon, Jul 21, 2008 at 04:03:27PM -0500, Hollis Blanchard wrote: > On Thu, 2008-07-10 at 20:49 -0300, Marcelo Tosatti wrote: > > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > > index b850d24..2c438a7 100644 > > --- a/arch/powerpc/kvm/powerpc.c > > +++ b/arch/powerpc/kvm/po

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-21 Thread Hollis Blanchard
On Thu, 2008-07-10 at 20:49 -0300, Marcelo Tosatti wrote: > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index b850d24..2c438a7 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -170,6 +170,11 @@ int kvm_arch_set_memory_region(struct kvm *kv

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-11 Thread Avi Kivity
Marcelo Tosatti wrote: KVM: MMU: improve invalid shadow root page handling Harden kvm_mmu_zap_page() against invalid root pages that had been shadowed from memslots that are gone. Applied, thanks. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. -- T

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-11 Thread Avi Kivity
Marcelo Tosatti wrote: On Thu, Jul 10, 2008 at 01:58:24PM -0500, Hollis Blanchard wrote: This (and its friends) ought to be static inlines. On the other hand, don't the other arches have to flush their tlbs? Xiantao/Hollis? So maybe this function needs to be renamed kvm_flush_shadow() an

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-10 Thread Marcelo Tosatti
KVM: MMU: improve invalid shadow root page handling Harden kvm_mmu_zap_page() against invalid root pages that had been shadowed from memslots that are gone. Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ff7cf63..7f57da6 100644 ---

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-10 Thread Marcelo Tosatti
On Thu, Jul 10, 2008 at 01:58:24PM -0500, Hollis Blanchard wrote: > > This (and its friends) ought to be static inlines. > > > > On the other hand, don't the other arches have to flush their tlbs? > > Xiantao/Hollis? So maybe this function needs to be renamed > > kvm_flush_shadow() and impleme

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-10 Thread Hollis Blanchard
On Thu, 2008-07-10 at 17:42 +0300, Avi Kivity wrote: > > > During RH6.2 graphical installation the following oops is triggered: > > > > BUG: unable to handle kernel NULL pointer dereference at > > > IP: [] :kvm:gfn_to_rmap+0x3e/0x61 > > Pid: 4559, comm: qemu-system-x86 Not tain

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-10 Thread Avi Kivity
Marcelo Tosatti wrote: On Mon, Jul 07, 2008 at 02:31:55PM -0300, Marcelo Tosatti wrote: On Sun, Jul 06, 2008 at 12:15:56AM +0300, Avi Kivity wrote: Marcelo Tosatti wrote: On Sat, Jul 05, 2008 at 08:25:30PM +0300, Avi Kivity wrote: @@ -1955,6 +1955,22 @@ void kvm_mmu

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-07 Thread Marcelo Tosatti
On Mon, Jul 07, 2008 at 02:31:55PM -0300, Marcelo Tosatti wrote: > On Sun, Jul 06, 2008 at 12:15:56AM +0300, Avi Kivity wrote: > > Marcelo Tosatti wrote: > >> On Sat, Jul 05, 2008 at 08:25:30PM +0300, Avi Kivity wrote: > >> > @@ -1955,6 +1955,22 @@ void kvm_mmu_slot_remove_write_access(st >

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-07 Thread Marcelo Tosatti
On Sun, Jul 06, 2008 at 12:15:56AM +0300, Avi Kivity wrote: > Marcelo Tosatti wrote: >> On Sat, Jul 05, 2008 at 08:25:30PM +0300, Avi Kivity wrote: >> @@ -1955,6 +1955,22 @@ void kvm_mmu_slot_remove_write_access(st } } +int kvm_mmu_slot_has_shadowed_page(struct kvm *kvm,

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-05 Thread Avi Kivity
Marcelo Tosatti wrote: On Sat, Jul 05, 2008 at 08:25:30PM +0300, Avi Kivity wrote: @@ -1955,6 +1955,22 @@ void kvm_mmu_slot_remove_write_access(st } } +int kvm_mmu_slot_has_shadowed_page(struct kvm *kvm, int slot) +{ + struct kvm_mmu_page *sp; + int ret = 0; + + sp

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-05 Thread Marcelo Tosatti
On Sat, Jul 05, 2008 at 08:25:30PM +0300, Avi Kivity wrote: >> @@ -1955,6 +1955,22 @@ void kvm_mmu_slot_remove_write_access(st >> } >> } >> +int kvm_mmu_slot_has_shadowed_page(struct kvm *kvm, int slot) >> +{ >> +struct kvm_mmu_page *sp; >> +int ret = 0; >> + >> +spin_lock(&kvm->

Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-05 Thread Avi Kivity
Marcelo Tosatti wrote: During RH6.2 graphical installation the following oops is triggered: BUG: unable to handle kernel NULL pointer dereference at IP: [] :kvm:gfn_to_rmap+0x3e/0x61 Pid: 4559, comm: qemu-system-x86 Not tainted RIP: 0010:[] [] :kvm:gfn_to_rmap+0x3e/0x61 @@

KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction

2008-07-03 Thread Marcelo Tosatti
During RH6.2 graphical installation the following oops is triggered: BUG: unable to handle kernel NULL pointer dereference at IP: [] :kvm:gfn_to_rmap+0x3e/0x61 Pid: 4559, comm: qemu-system-x86 Not tainted RIP: 0010:[] [] :kvm:gfn_to_rmap+0x3e/0x61 Process qemu-system-x86 (