]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mm/shadow: spurious warning when unmapping xenheap pages.
authorTim Deegan <tim@xen.org>
Tue, 9 Apr 2013 14:07:23 +0000 (16:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 9 Apr 2013 14:07:23 +0000 (16:07 +0200)
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 <andrew.cooper3@citrix.com>
Signed-off-by: Tim Deegan <tim@xen.org>
Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: cfc515dabe91e3d6c690c68c6a669d6d77fb7ac4
master date: 2013-04-04 10:14:30 +0100

xen/arch/x86/mm/shadow/common.c
xen/include/asm-x86/mm.h

index dc245befee53e0fe8d331bb853a36fee8f001e04..ef06a03314b9686b57737ac44c3b2d4aa2c5d76d 100644 (file)
@@ -2515,10 +2515,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), 
index a7bb3bb3f0e2e12bb641476429a3c6c0d2fcbeda..ba925685b5c5064a64ba75e352c5af0afe40f87d 100644 (file)
@@ -246,7 +246,7 @@ struct spage_info
 #endif
 
 #if defined(__i386__)
-#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
+#define is_xen_heap_page(page) is_xen_heap_mfn(__page_to_mfn(page))
 #define is_xen_heap_mfn(mfn) ({                         \
     unsigned long _mfn = (mfn);                         \
     (_mfn < paddr_to_pfn(xenheap_phys_end));            \