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

[Xen-devel] [PATCH] Fix Xen panic with oprofile


  • To: "Xen Developers" <xen-devel@xxxxxxxxxxxxxxxxxxx>, xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
  • From: "Niraj Tolia" <ntolia@xxxxxxxxx>
  • Date: Tue, 2 Dec 2008 00:52:00 -0800
  • Cc: "Santos, Jose Renato G" <joserenato.santos@xxxxxx>, "Monchiero, Matteo" <matteo.monchiero@xxxxxx>
  • Delivery-date: Tue, 02 Dec 2008 00:52:26 -0800
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type :content-transfer-encoding:content-disposition; b=NNHoIowCLHqW86Zk6zOR483eApfHXn64EJ6zJXuCYKJcE1uG2YCpXm/b96PtfzDZiH YkuANJOLcda0e32NDnjSbJ4GQ505tuEJx/AqxsWylsZoC5FCZmymZ4PxCSTA8iUw9Pcj Psl2Utbi9xNki6PwiL7Rmy5Gn0YeNS5dWuH8I=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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@xxxxxx>

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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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