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

[Xen-changelog] [xen-unstable] x86: Fix the P2M audit code.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1242772105 -3600
# Node ID 6e286d08c4a934491df37a00084bb78ce8f4c000
# Parent  e0221531d0e583d74d27a56155ffd8f4cb46f32c
x86: Fix the P2M audit code.

It currently doesn't even compile; with this patch applied, it
compiles and didn't immediately explode as soon as I started a VM.
I've not given it much testing beyond that, though.

Signed-off-by: Steven Smith <steven.smith@xxxxxxxxxx>
---
 xen/arch/x86/mm/p2m.c |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff -r e0221531d0e5 -r 6e286d08c4a9 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue May 19 14:17:56 2009 +0100
+++ b/xen/arch/x86/mm/p2m.c     Tue May 19 23:28:25 2009 +0100
@@ -1623,7 +1623,6 @@ void p2m_final_teardown(struct domain *d
 #if P2M_AUDIT
 static void audit_p2m(struct domain *d)
 {
-    struct list_head *entry;
     struct page_info *page;
     struct domain *od;
     unsigned long mfn, gfn, m2pfn, lp2mfn = 0;
@@ -1647,11 +1646,8 @@ static void audit_p2m(struct domain *d)
 
     /* Audit part one: walk the domain's page allocation list, checking
      * the m2p entries. */
-    for ( entry = d->page_list.next;
-          entry != &d->page_list;
-          entry = entry->next )
-    {
-        page = list_entry(entry, struct page_info, list);
+    page_list_for_each ( page, &d->page_list )
+    {
         mfn = mfn_x(page_to_mfn(page));
 
         // P2M_PRINTK("auditing guest page, mfn=%#lx\n", mfn);
@@ -1777,7 +1773,7 @@ static void audit_p2m(struct domain *d)
                             {
                                 pmbad++;
                                 P2M_PRINTK("mismatch: gfn %#lx -> mfn %#lx"
-                                           " -> gfn %#lx\n", gfn+i, mfn+i,
+                                           " -> gfn %#lx\n", gfn+i1, mfn+i1,
                                            m2pfn);
                                 BUG();
                             }
@@ -1800,7 +1796,8 @@ static void audit_p2m(struct domain *d)
                         mfn = l1e_get_pfn(l1e[i1]);
                         ASSERT(mfn_valid(_mfn(mfn)));
                         m2pfn = get_gpfn_from_mfn(mfn);
-                        if ( m2pfn != gfn )
+                        if ( m2pfn != gfn &&
+                             p2m_flags_to_type(l1e_get_flags(l1e[i1])) != 
p2m_mmio_direct )
                         {
                             pmbad++;
                             printk("mismatch: gfn %#lx -> mfn %#lx"
@@ -1924,7 +1921,7 @@ guest_physmap_mark_populate_on_demand(st
     p2m_lock(p2md);
     audit_p2m(d);
 
-    P2M_DEBUG("adding gfn=%#lx mfn=%#lx\n", gfn, mfn);
+    P2M_DEBUG("mark pod gfn=%#lx\n", gfn);
 
     /* Make sure all gpfns are unused */
     for ( i = 0; i < (1UL << order); i++ )
@@ -2212,6 +2209,7 @@ set_mmio_p2m_entry(struct domain *d, uns
         set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
     }
 
+    P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
     rc = set_p2m_entry(d, gfn, mfn, 0, p2m_mmio_direct);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,

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


 


Rackspace

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