[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86/mm: Clean up mem event structures on domain destruction



# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1331224805 0
# Node ID 1ec39d7b9f22f218ed82bccd1d89402056f6d185
# Parent  07913faff6847f29d8d0d98608fcabf97d12fb73
x86/mm: Clean up mem event structures on domain destruction

Otherwise we wind up with zombie domains, still holding onto refs to the mem
event ring pages.

Signed-off-by: Andres Lagar-Cavilla <andres@xxxxxxxxxxxxxxxx>
Acked-by: Tim Deegan <tim@xxxxxxx>
Committed-by: Tim Deegan <tim@xxxxxxx>
---


diff -r 07913faff684 -r 1ec39d7b9f22 xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c       Thu Mar 08 16:40:05 2012 +0000
+++ b/xen/arch/x86/mm/mem_event.c       Thu Mar 08 16:40:05 2012 +0000
@@ -486,6 +486,17 @@
     return ret;
 }
 
+/* Clean up on domain destruction */
+void mem_event_cleanup(struct domain *d)
+{
+    if ( d->mem_event->paging.ring_page )
+        (void)mem_event_disable(d, &d->mem_event->paging);
+    if ( d->mem_event->access.ring_page )
+        (void)mem_event_disable(d, &d->mem_event->access);
+    if ( d->mem_event->share.ring_page )
+        (void)mem_event_disable(d, &d->mem_event->share);
+}
+
 int mem_event_domctl(struct domain *d, xen_domctl_mem_event_op_t *mec,
                      XEN_GUEST_HANDLE(void) u_domctl)
 {
diff -r 07913faff684 -r 1ec39d7b9f22 xen/common/domain.c
--- a/xen/common/domain.c       Thu Mar 08 16:40:05 2012 +0000
+++ b/xen/common/domain.c       Thu Mar 08 16:40:05 2012 +0000
@@ -479,6 +479,9 @@
             break;
         }
         d->is_dying = DOMDYING_dead;
+        /* Mem event cleanup has to go here because the rings 
+         * have to be put before we call put_domain. */
+        mem_event_cleanup(d);
         put_domain(d);
         send_global_virq(VIRQ_DOM_EXC);
         /* fallthrough */
diff -r 07913faff684 -r 1ec39d7b9f22 xen/include/asm-arm/mm.h
--- a/xen/include/asm-arm/mm.h  Thu Mar 08 16:40:05 2012 +0000
+++ b/xen/include/asm-arm/mm.h  Thu Mar 08 16:40:05 2012 +0000
@@ -247,7 +247,8 @@
         machine_to_phys_mapping[(mfn)] = (pfn);                \
     })
 
-#define put_gfn(d, g)   ((void)0)
+static inline void put_gfn(struct domain *d, unsigned long gfn) {}
+static inline void mem_event_cleanup(struct domain *d) {}
 
 #define INVALID_MFN             (~0UL)
 
diff -r 07913faff684 -r 1ec39d7b9f22 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Thu Mar 08 16:40:05 2012 +0000
+++ b/xen/include/asm-ia64/mm.h Thu Mar 08 16:40:05 2012 +0000
@@ -551,7 +551,8 @@
     gmfn_to_mfn_foreign((_d), (gpfn))
 
 #define get_gfn_untyped(d, gpfn) gmfn_to_mfn(d, gpfn)
-#define put_gfn(d, g)   ((void)0)
+static inline void put_gfn(struct domain *d, unsigned long gfn) {}
+static inline void mem_event_cleanup(struct domain *d) {}
 
 #define __gpfn_invalid(_d, gpfn)                       \
        (lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL) == INVALID_MFN)
diff -r 07913faff684 -r 1ec39d7b9f22 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Thu Mar 08 16:40:05 2012 +0000
+++ b/xen/include/asm-x86/mm.h  Thu Mar 08 16:40:05 2012 +0000
@@ -634,6 +634,12 @@
 
 unsigned long domain_get_maximum_gpfn(struct domain *d);
 
+#ifdef CONFIG_X86_64
+void mem_event_cleanup(struct domain *d);
+#else
+static inline void mem_event_cleanup(struct domain *d) {}
+#endif
+
 extern struct domain *dom_xen, *dom_io, *dom_cow;      /* for vmcoreinfo */
 
 /* Definition of an mm lock: spinlock with extra fields for debugging */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.