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. The patch was generated against Xen 3.3.0 but will cleanly apply to both xen-3.3-testing and xen-unstable. It has only been tested on x86_32 but the ia64 portion of it should (hopefully) be obvious. Note that I needed to backport the patch from [1] to get samples on my processor (Xeon X5355) but, as the patch doesn''t seem to have gone into mainline yet [2], I am holding off on submitting it here. Cheers, Niraj [1] http://lkml.org/lkml/2008/11/11/62 [2] http://lkml.org/lkml/2008/11/17/282 Signed-off-by: Niraj Tolia <niraj.tolia@hp.com> diff -r 18eff064c628 xen/arch/ia64/xen/domain.c --- a/xen/arch/ia64/xen/domain.c Fri Aug 22 10:45:19 2008 +0100 +++ b/xen/arch/ia64/xen/domain.c Mon Dec 01 23:52:14 2008 -0800 @@ -1673,9 +1673,6 @@ int domain_relinquish_resources(struct 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 -r 18eff064c628 xen/arch/x86/domain.c --- a/xen/arch/x86/domain.c Fri Aug 22 10:45:19 2008 +0100 +++ b/xen/arch/x86/domain.c Mon Dec 01 23:52:14 2008 -0800 @@ -1817,9 +1817,6 @@ int domain_relinquish_resources(struct d BUG(); } - /* Free page used by xen oprofile buffer. */ - free_xenoprof_pages(d); - if ( is_hvm_domain(d) ) hvm_domain_relinquish_resources(d); diff -r 18eff064c628 xen/common/domain.c --- a/xen/common/domain.c Fri Aug 22 10:45:19 2008 +0100 +++ b/xen/common/domain.c Mon Dec 01 23:52:14 2008 -0800 @@ -534,6 +534,9 @@ static void complete_domain_destroy(stru 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); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel