From: Andrew Cooper Subject: Re: [PATCH] x86/mm/shadow: spurious warning when unmapping xenheap pages. Date: Tue, 2 Apr 2013 11:09:22 +0100 Message-ID: <515AAE52.8070402@citrix.com> References: <1364466950-15682-1-git-send-email-tim@xen.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1364466950-15682-1-git-send-email-tim@xen.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 28/03/13 10:35, Tim Deegan wrote: > Xenheap pages will always have an extra typecount, taken in > share_xen_page_with_guest(), which doesn't come from a shadow PTE. > Adjust the warning in sh_remove_all_mappings() to account for it. > > Reported-by: Andrew Cooper > Signed-off-by: Tim Deegan Tested-by: Andrew Cooper > --- > xen/arch/x86/mm/shadow/common.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c > index 4b576ac..adffa06 100644 > --- a/xen/arch/x86/mm/shadow/common.c > +++ b/xen/arch/x86/mm/shadow/common.c > @@ -2437,10 +2437,13 @@ int sh_remove_all_mappings(struct vcpu *v, mfn_t gmfn) > { > /* Don't complain if we're in HVM and there are some extra mappings: > * The qemu helper process has an untyped mapping of this dom's RAM > - * and the HVM restore program takes another. */ > + * and the HVM restore program takes another. > + * Also allow one typed refcount for xenheap pages, to match > + * share_xen_page_with_guest(). */ > if ( !(shadow_mode_external(v->domain) > && (page->count_info & PGC_count_mask) <= 3 > - && (page->u.inuse.type_info & PGT_count_mask) == 0) ) > + && ((page->u.inuse.type_info & PGT_count_mask) > + == !!is_xen_heap_page(page))) ) > { > SHADOW_ERROR("can't find all mappings of mfn %lx: " > "c=%08lx t=%08lx\n", mfn_x(gmfn),