[XEN] When removing pages, drop shadow refs before complaining about refcount.
authorTim Deegan <Tim.Deegan@xensource.com>
Thu, 8 Feb 2007 10:44:53 +0000 (10:44 +0000)
committerTim Deegan <Tim.Deegan@xensource.com>
Thu, 8 Feb 2007 10:44:53 +0000 (10:44 +0000)
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
xen/common/memory.c
xen/include/asm-x86/shadow.h

index 78887e19a6fe7bcbc76f44b98897625b9b178a06..fcd483818d4ca6a5ea826101fbe28b56330134be 100644 (file)
@@ -175,11 +175,13 @@ int guest_remove_page(struct domain *d, unsigned long gmfn)
 
     if ( unlikely(!page_is_removable(page)) )
     {
+        shadow_drop_references(d, page);
         /* We'll make this a guest-visible error in future, so take heed! */
-        gdprintk(XENLOG_INFO, "Dom%d freeing in-use page %lx (pseudophys %lx):"
-                " count=%lx type=%lx\n",
-                d->domain_id, mfn, get_gpfn_from_mfn(mfn),
-                (unsigned long)page->count_info, page->u.inuse.type_info);
+        if ( !page_is_removable(page) )
+            gdprintk(XENLOG_INFO, "Dom%d freeing in-use page %lx "
+                     "(pseudophys %lx): count=%lx type=%lx\n",
+                     d->domain_id, mfn, get_gpfn_from_mfn(mfn),
+                     (unsigned long)page->count_info, page->u.inuse.type_info);
     }
 
     guest_physmap_remove_page(d, gmfn, mfn);
index 2afc0b0562fb1b06cd780a20bd0e269a1151af88..a4a489dcf5164eccb01b2264ae308b805199ad5f 100644 (file)
@@ -355,8 +355,9 @@ int sh_remove_all_mappings(struct vcpu *v, mfn_t target_mfn);
 static inline void 
 shadow_drop_references(struct domain *d, struct page_info *p)
 {
-    /* See the comment about locking in sh_remove_all_mappings */
-    sh_remove_all_mappings(d->vcpu[0], _mfn(page_to_mfn(p)));
+    if ( unlikely(shadow_mode_enabled(d)) )
+        /* See the comment about locking in sh_remove_all_mappings */
+        sh_remove_all_mappings(d->vcpu[0], _mfn(page_to_mfn(p)));
 }
 
 /* Remove all shadows of the guest mfn. */