diff options
-rw-r--r-- | xen/common/memory.c | 10 | ||||
-rw-r--r-- | xen/include/asm-x86/shadow.h | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c index 78887e19a6..fcd483818d 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -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); diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 2afc0b0562..a4a489dcf5 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -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. */ |