WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] PoD: Check p2m assumption in debug builds

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] PoD: Check p2m assumption in debug builds
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Sep 2009 02:00:24 -0700
Delivery-date: Tue, 15 Sep 2009 02:00:50 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1253002418 -3600
# Node ID 582970a2d2dcd1d041ab29237ea8f8a2e31b8989
# Parent  973f4bbf472331a59a9f3ae716bfb72347767f46
PoD: Check p2m assumption in debug builds

The PoD code assumes that if:
* A page is in a domain's p2m table
* And it's owned by the domain
* And it's not a xenheap page
then:
* It's on the domain's page list.

This patch adds a check for this assumption when debug=y.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---
 xen/arch/x86/mm/p2m.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)

diff -r 973f4bbf4723 -r 582970a2d2dc xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue Sep 15 09:13:01 2009 +0100
+++ b/xen/arch/x86/mm/p2m.c     Tue Sep 15 09:13:38 2009 +0100
@@ -1530,6 +1530,36 @@ int set_p2m_entry(struct domain *d, unsi
                 9 : 0;
         else
             order = 0;
+
+#ifndef NDEBUG
+        /* PoD code assumes that a page owned by the domain, not from the 
xenheap, and in the p2m
+         * is on the domain page list.  Verify this assumption. */
+        if ( mfn_valid(mfn)
+             && p2m_is_ram(p2mt)
+             && page_get_owner(mfn_to_page(mfn))==d
+             && ( (mfn_to_page(mfn)->count_info & PGC_xen_heap) == 0 ) )
+        {
+            struct page_info *p, *q;
+
+            p = mfn_to_page(mfn);
+
+            spin_lock(&d->page_alloc_lock);
+           
+            /* Walk the domain page list and make sure this page is on it... */
+            for ( q = page_list_first(&d->page_list) ; q; q = 
page_list_next(q, &d->page_list) )
+                if ( q == p )
+                    break;
+            if ( !q )
+            {
+                printk("%s: mfn %lx owned by d%d, not xen_heap, but not on 
domain page_list!\n",
+                       __func__, mfn_x(mfn), d->domain_id);
+                BUG();
+            }   
+
+            spin_unlock(&d->page_alloc_lock);
+        }
+#endif
+
         rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
         gfn += 1ul << order;
         if ( mfn_x(mfn) != INVALID_MFN )

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] PoD: Check p2m assumption in debug builds, Xen patchbot-unstable <=