From: Keir Fraser Date: Tue, 2 Dec 2008 11:53:24 +0000 (+0000) Subject: Fix Xen panic with oprofile X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14040^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3f5125965b7a918a54fa7867c30c8a2910d3c6b0;p=xen.git Fix Xen panic with oprofile 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 --- diff --git a/xen/arch/ia64/xen/domain.c b/xen/arch/ia64/xen/domain.c index 68b243a9de..0a2b22a123 100644 --- a/xen/arch/ia64/xen/domain.c +++ b/xen/arch/ia64/xen/domain.c @@ -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; } diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d9aef685d0..044838bf00 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -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); diff --git a/xen/common/domain.c b/xen/common/domain.c index 7e1f0ebe28..0613da249e 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -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);