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-devel

[Xen-devel] [PATCH] Fix the P2M audit code

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix the P2M audit code
From: <steven.smith@xxxxxxxxxxxxx>
Date: Tue, 19 May 2009 12:26:29 +0100
Delivery-date: Tue, 19 May 2009 04:21:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Steven Smith <steven.smith@xxxxxxxxxxxxx>
# Date 1242731493 -3600
# Node ID 20b69e03fbd099226652fb9ba1540d5e93f35438
# Parent  780041c4a96d6bb4eb8bb4ed61c916c8c535448c
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>

diff -r 780041c4a96d -r 20b69e03fbd0 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue May 19 02:23:32 2009 +0100
+++ b/xen/arch/x86/mm/p2m.c     Tue May 19 12:11:33 2009 +0100
@@ -1623,7 +1623,6 @@
 #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 @@
 
     /* 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_for_each ( page, &d->page_list )
     {
-        page = list_entry(entry, struct page_info, list);
         mfn = mfn_x(page_to_mfn(page));
 
         // P2M_PRINTK("auditing guest page, mfn=%#lx\n", mfn);
@@ -1777,7 +1773,7 @@
                             {
                                 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 @@
                         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 @@
     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_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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix the P2M audit code, steven.smith <=