All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PoD: Handle operations properly when domain is dying
@ 2009-11-11 15:08 George Dunlap
  2009-11-11 15:26 ` Dan Magenheimer
  0 siblings, 1 reply; 12+ messages in thread
From: George Dunlap @ 2009-11-11 15:08 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

Handle PoD operations properly when a domain is dying.

No populate-on-demand activities should happen when a domain is dying.
 Especially, it is a bug for memory to be added to the PoD cache when
d->is_dying is non-zero, since if this happens after the cache has
been emptied, these pages will never be freed. This may cause "zombie
domains" to linger.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>

[-- Attachment #2: 20091111-pod-domain-dying-issues.diff --]
[-- Type: text/x-diff, Size: 1668 bytes --]

diff -r 01a941f2c9f5 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Wed Nov 11 13:11:44 2009 +0000
+++ b/xen/arch/x86/mm/p2m.c	Wed Nov 11 15:04:27 2009 +0000
@@ -303,6 +303,8 @@
         BUG();
     }
 
+    BUG_ON(d->is_dying);
+
     spin_unlock(&d->page_alloc_lock);
 
     return 0;
@@ -503,6 +505,10 @@
     if ( p2md->pod.entry_count == 0 )
         goto out;
 
+    /* Don't do anything if the domain is being torn down */
+    if ( d->is_dying )
+        goto out;
+
     /* T' < B: Don't reduce the cache size; let the balloon driver
      * take care of it. */
     if ( target < d->tot_pages )
@@ -582,7 +588,7 @@
 
     /* If we don't have any outstanding PoD entries, let things take their
      * course */
-    if ( p2md->pod.entry_count == 0 )
+    if ( p2md->pod.entry_count == 0 || unlikely(d->is_dying) )
         goto out;
 
     /* Figure out if we need to steal some freed memory for our cache */
@@ -1002,6 +1008,12 @@
     struct p2m_domain *p2md = d->arch.p2m;
     int i;
 
+    /* This check is done with the p2m lock held.  This will make sure that
+     * even if d->is_dying changes under our feet, empty_pod_cache() won't start
+     * until we're done. */
+    if ( unlikely(d->is_dying) )
+        goto out_fail;
+
     /* If we're low, start a sweep */
     if ( order == 9 && page_list_empty(&p2md->pod.super) )
         p2m_pod_emergency_sweep_super(d);
@@ -1048,6 +1060,7 @@
     printk("%s: Out of populate-on-demand memory! tot_pages %" PRIu32 " pod_entries %" PRIi32 "\n",
            __func__, d->tot_pages, p2md->pod.entry_count);
     domain_crash(d);
+out_fail:
     return -1;
 remap_and_retry:
     BUG_ON(order != 9);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2009-11-12 10:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-11 15:08 [PATCH] PoD: Handle operations properly when domain is dying George Dunlap
2009-11-11 15:26 ` Dan Magenheimer
2009-11-11 15:42   ` George Dunlap
2009-11-11 16:53     ` Dan Magenheimer
2009-11-11 17:13       ` Keir Fraser
2009-11-11 17:15       ` George Dunlap
2009-11-11 17:58         ` Dan Magenheimer
2009-11-11 22:49           ` George Dunlap
2009-11-11 23:34             ` Dan Magenheimer
2009-11-12 10:56               ` George Dunlap
2009-11-11 18:12   ` Dave Scott
2009-11-11 18:27     ` Dan Magenheimer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.