ia64/xen-unstable

changeset 19624:6e286d08c4a9

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@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 19 23:28:25 2009 +0100 (2009-05-19)
parents e0221531d0e5
children d8d0f32090cb
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Tue May 19 14:17:56 2009 +0100
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Tue May 19 23:28:25 2009 +0100
     1.3 @@ -1623,7 +1623,6 @@ void p2m_final_teardown(struct domain *d
     1.4  #if P2M_AUDIT
     1.5  static void audit_p2m(struct domain *d)
     1.6  {
     1.7 -    struct list_head *entry;
     1.8      struct page_info *page;
     1.9      struct domain *od;
    1.10      unsigned long mfn, gfn, m2pfn, lp2mfn = 0;
    1.11 @@ -1647,11 +1646,8 @@ static void audit_p2m(struct domain *d)
    1.12  
    1.13      /* Audit part one: walk the domain's page allocation list, checking
    1.14       * the m2p entries. */
    1.15 -    for ( entry = d->page_list.next;
    1.16 -          entry != &d->page_list;
    1.17 -          entry = entry->next )
    1.18 +    page_list_for_each ( page, &d->page_list )
    1.19      {
    1.20 -        page = list_entry(entry, struct page_info, list);
    1.21          mfn = mfn_x(page_to_mfn(page));
    1.22  
    1.23          // P2M_PRINTK("auditing guest page, mfn=%#lx\n", mfn);
    1.24 @@ -1777,7 +1773,7 @@ static void audit_p2m(struct domain *d)
    1.25                              {
    1.26                                  pmbad++;
    1.27                                  P2M_PRINTK("mismatch: gfn %#lx -> mfn %#lx"
    1.28 -                                           " -> gfn %#lx\n", gfn+i, mfn+i,
    1.29 +                                           " -> gfn %#lx\n", gfn+i1, mfn+i1,
    1.30                                             m2pfn);
    1.31                                  BUG();
    1.32                              }
    1.33 @@ -1800,7 +1796,8 @@ static void audit_p2m(struct domain *d)
    1.34                          mfn = l1e_get_pfn(l1e[i1]);
    1.35                          ASSERT(mfn_valid(_mfn(mfn)));
    1.36                          m2pfn = get_gpfn_from_mfn(mfn);
    1.37 -                        if ( m2pfn != gfn )
    1.38 +                        if ( m2pfn != gfn &&
    1.39 +                             p2m_flags_to_type(l1e_get_flags(l1e[i1])) != p2m_mmio_direct )
    1.40                          {
    1.41                              pmbad++;
    1.42                              printk("mismatch: gfn %#lx -> mfn %#lx"
    1.43 @@ -1924,7 +1921,7 @@ guest_physmap_mark_populate_on_demand(st
    1.44      p2m_lock(p2md);
    1.45      audit_p2m(d);
    1.46  
    1.47 -    P2M_DEBUG("adding gfn=%#lx mfn=%#lx\n", gfn, mfn);
    1.48 +    P2M_DEBUG("mark pod gfn=%#lx\n", gfn);
    1.49  
    1.50      /* Make sure all gpfns are unused */
    1.51      for ( i = 0; i < (1UL << order); i++ )
    1.52 @@ -2212,6 +2209,7 @@ set_mmio_p2m_entry(struct domain *d, uns
    1.53          set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
    1.54      }
    1.55  
    1.56 +    P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
    1.57      rc = set_p2m_entry(d, gfn, mfn, 0, p2m_mmio_direct);
    1.58      if ( 0 == rc )
    1.59          gdprintk(XENLOG_ERR,