From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hollis Blanchard Subject: Re: KVM: MMU: nuke shadowed pgtable pages and pte's on memslot destruction Date: Thu, 10 Jul 2008 13:58:24 -0500 Message-ID: <1215716304.16858.64.camel@localhost.localdomain> References: <20080704010618.GA25834@dmt.cnet> <486FAE8A.2050308@qumranet.com> <20080705192344.GA16596@dmt.cnet> <486FE48C.7030002@qumranet.com> <20080707173155.GB10372@dmt.cnet> <20080707195822.GA16787@dmt.cnet> <48761FCB.4080307@qumranet.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , "Richard W.M. Jones" , kvm-devel , "Zhang, Xiantao" To: Avi Kivity Return-path: Received: from e5.ny.us.ibm.com ([32.97.182.145]:55286 "EHLO e5.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751083AbYGJS6i (ORCPT ); Thu, 10 Jul 2008 14:58:38 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e5.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m6AIwatv014291 for ; Thu, 10 Jul 2008 14:58:36 -0400 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m6AIwQK6192840 for ; Thu, 10 Jul 2008 14:58:26 -0400 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m6AIwPim024539 for ; Thu, 10 Jul 2008 14:58:26 -0400 In-Reply-To: <48761FCB.4080307@qumranet.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 > 0000000000000000 > > IP: [] :kvm:gfn_to_rmap+0x3e/0x61 > > Pid: 4559, comm: qemu-system-x86 Not tainted > > > > The problem is that KVM allows shadow pagetable entries that > > point to a removed memslot to exist. In this case the cirrus vram > > mapping was removed, and the NULL dereference happened during > > kvm_set_memory_alias()'s zap_all_pages(). > > > > So nuke all shadowed pages before memslot removal. > > > > Signed-off-by: Marcelo Tosatti > > > > > > diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c > > index a4cf4a2..76259da 100644 > > --- a/arch/ia64/kvm/kvm-ia64.c > > +++ b/arch/ia64/kvm/kvm-ia64.c > > @@ -1455,6 +1455,10 @@ int kvm_arch_set_memory_region(struct kvm > *kvm, > > return 0; > > } > > > > +int kvm_arch_destroy_memory_region(struct kvm *kvm, int slot) > > +{ > > + return 0; > > +} > > > > > > 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 implemented across the board. Agreed, I think that's the right approach. -- Hollis Blanchard IBM Linux Technology Center