Fix Xen panic with oprofile
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 2 Dec 2008 11:53:24 +0000 (11:53 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 2 Dec 2008 11:53:24 +0000 (11:53 +0000)
The attached patch fixes a Xen panic when a domain is shutdown before
oprofile is stopped. Without this patch, free_xenoprof_pages() is
called before the domain is destroyed and that, in turn, prevents
oprofile from cleaning up pages shared with guests. Shutting down a
domain without terminating oprofile therefore causes a Xen panic at a
later point in time.

Signed-off-by: Niraj Tolia <niraj.tolia@hp.com>
xen/arch/ia64/xen/domain.c
xen/arch/x86/domain.c
xen/common/domain.c

index 68b243a9dee98672c4273b1e7dbf948f0352a342..0a2b22a123e3adee7c4d9c8d1f23d00c391cdbca 100644 (file)
@@ -1686,9 +1686,6 @@ int domain_relinquish_resources(struct domain *d)
        if (is_hvm_domain(d) && d->arch.sal_data)
                xfree(d->arch.sal_data);
 
-       /* Free page used by xen oprofile buffer */
-       free_xenoprof_pages(d);
-
        return 0;
 }
 
index d9aef685d0e8a74d9cfee58ded5445d8c604d589..044838bf00e21d3b276ad4e3b303a9af58eb9a10 100644 (file)
@@ -1864,9 +1864,6 @@ int domain_relinquish_resources(struct domain *d)
         BUG();
     }
 
-    /* Free page used by xen oprofile buffer. */
-    free_xenoprof_pages(d);
-
     if ( is_hvm_domain(d) )
         hvm_domain_relinquish_resources(d);
 
index 7e1f0ebe28a860df86e32cff36c36742e63d2718..0613da249ef6c559d560d29449d0907dcdef5aa8 100644 (file)
@@ -553,6 +553,9 @@ static void complete_domain_destroy(struct rcu_head *head)
 
     sched_destroy_domain(d);
 
+    /* Free page used by xen oprofile buffer. */
+    free_xenoprof_pages(d);
+
     for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
         if ( (v = d->vcpu[i]) != NULL )
             free_vcpu_struct(v);