All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Vrable <mvrable@cs.ucsd.edu>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH] Fix compilation of shadow mode debugging code
Date: Thu, 2 Jun 2005 10:06:55 -0700	[thread overview]
Message-ID: <20050602170655.GA27101@vrable.net> (raw)
In-Reply-To: <E1DdkjF-0007Ha-00@mta1.cl.cam.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 317 bytes --]

On Thu, Jun 02, 2005 at 09:07:01AM +0100, Keir Fraser wrote:
> Unfortunately it doesn't apply to the current repository, even with
> patch fuzz enabled.

I've updated the patch for the most recent nightly snapshot; I hope this
will get it to apply to the current repository.  New patch is attached.

--Michael Vrable

[-- Attachment #2: shadow-debug-fix2.patch --]
[-- Type: text/plain, Size: 8243 bytes --]

The merge of PAE support introduced the intpte_t type and PRIpte format
specifier.  Most of the shadow mode code was fixed, but debugging
printks were not; this broke the compile if shadow mode debugging was
enabled.

The attached patch should fix the problem.  Not tested with PAE enabled,
but it shouldn't make anything worse than it already is.

Signed-off-by: Michael Vrable <mvrable@cs.ucsd.edu>

diff -urN orig/xen/arch/x86/shadow.c mod/xen/arch/x86/shadow.c
--- orig/xen/arch/x86/shadow.c	2005-06-02 09:04:13.000000000 -0700
+++ mod/xen/arch/x86/shadow.c	2005-06-02 09:36:52.000000000 -0700
@@ -1222,8 +1222,8 @@
     ASSERT(shadow_lock_is_acquired(d));
 
     SH_VLOG("shadow mode table op %lx %lx count %d",
-            pagetable_val(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
-            pagetable_val(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
+            (unsigned long)pagetable_get_pfn(d->exec_domain[0]->arch.guest_table),  /* XXX SMP */
+            (unsigned long)pagetable_get_pfn(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */
             d->arch.shadow_page_count);
 
     shadow_audit(d, 1);
@@ -2594,7 +2594,7 @@
     orig_gpte = gpte = linear_pg_table[l1_linear_offset(va)];
     if ( unlikely(!(l1e_get_flags(gpte) & _PAGE_PRESENT)) )
     {
-        SH_VVLOG("shadow_fault - EXIT: gpte not present (%lx)",
+        SH_VVLOG("shadow_fault - EXIT: gpte not present (%" PRIpte ")",
                  l1e_get_intpte(gpte));
         perfc_incrc(shadow_fault_bail_pte_not_present);
         goto fail;
@@ -2615,7 +2615,7 @@
             else
             {
                 /* Write fault on a read-only mapping. */
-                SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%lx)", 
+                SH_VVLOG("shadow_fault - EXIT: wr fault on RO page (%" PRIpte ")", 
                          l1e_get_intpte(gpte));
                 perfc_incrc(shadow_fault_bail_ro_mapping);
                 goto fail;
@@ -2692,7 +2692,7 @@
     sl1mfn = __shadow_status(current->domain, pa >> PAGE_SHIFT, PGT_l1_shadow);
     if ( sl1mfn )
     {
-        SH_VVLOG("shadow_l1_normal_pt_update pa=%p, gpte=%08lx",
+        SH_VVLOG("shadow_l1_normal_pt_update pa=%p, gpte=%" PRIpte,
                  (void *)pa, l1e_get_intpte(gpte));
         l1pte_propagate_from_guest(current->domain, gpte, &spte);
 
@@ -2717,7 +2717,7 @@
     sl2mfn = __shadow_status(current->domain, pa >> PAGE_SHIFT, PGT_l2_shadow);
     if ( sl2mfn )
     {
-        SH_VVLOG("shadow_l2_normal_pt_update pa=%p, gpde=%08lx",
+        SH_VVLOG("shadow_l2_normal_pt_update pa=%p, gpde=%" PRIpte,
                  (void *)pa, l2e_get_intpte(gpde));
         spl2e = map_domain_mem_with_cache(sl2mfn << PAGE_SHIFT, cache);
         validate_pde_change(d, gpde,
@@ -2946,7 +2946,7 @@
     {
         l2e = map_domain_mem(smfn << PAGE_SHIFT);
         for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
-            if ( is_guest_l2_slot(i) &&
+            if ( is_guest_l2_slot(0, i) &&
                  (l2e_get_flags(l2e[i]) & _PAGE_PRESENT) )
                 l2e_add_flags(l2e[i], SHADOW_REFLECTS_SNAPSHOT);
         unmap_domain_mem(l2e);
@@ -2978,9 +2978,10 @@
         printk("XXX %s-FAIL (%d,%d,%d) " _f " at %s(%d)\n",                  \
                sh_check_name, level, l2_idx, l1_idx, ## _a,                  \
                __FILE__, __LINE__);                                          \
-        printk("guest_pte=%lx eff_guest_pte=%lx shadow_pte=%lx "             \
-               "snapshot_pte=%lx &guest=%p &shadow=%p &snap=%p "             \
-               "v2m(&guest)=%p v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n",     \
+        printk("guest_pte=%" PRIpte " eff_guest_pte=%" PRIpte                \
+               " shadow_pte=%" PRIpte " snapshot_pte=%" PRIpte               \
+               " &guest=%p &shadow=%p &snap=%p v2m(&guest)=%p"               \
+               " v2m(&shadow)=%p v2m(&snap)=%p ea=%08x\n",                   \
                l1e_get_intpte(guest_pte), l1e_get_intpte(eff_guest_pte),     \
                l1e_get_intpte(shadow_pte), l1e_get_intpte(snapshot_pte),     \
                p_guest_pte, p_shadow_pte, p_snapshot_pte,                    \
@@ -3048,8 +3049,8 @@
     shadow_mfn = l1e_get_pfn(shadow_pte);
 
     if ( !VALID_MFN(eff_guest_mfn) && !shadow_mode_refcounts(d) )
-        FAIL("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%lx\n", __func__, eff_guest_pfn,
-             l1e_get_intpte(eff_guest_pte));
+        FAIL("%s: invalid eff_guest_pfn=%lx eff_guest_pte=%" PRIpte "\n",
+             __func__, eff_guest_pfn, l1e_get_intpte(eff_guest_pte));
 
     page_table_page = mfn_is_page_table(eff_guest_mfn);
 
@@ -3184,7 +3185,7 @@
          l2e_has_changed(spl2e[SH_LINEAR_PT_VIRT_START >> L2_PAGETABLE_SHIFT],
                          match, PAGE_FLAG_MASK))
     {
-        FAILPT("hypervisor shadow linear map inconsistent %lx %lx",
+        FAILPT("hypervisor shadow linear map inconsistent %" PRIpte " %" PRIpte,
                l2e_get_intpte(spl2e[SH_LINEAR_PT_VIRT_START >>
                                    L2_PAGETABLE_SHIFT]),
                l2e_get_intpte(match));
@@ -3195,7 +3196,7 @@
          l2e_has_changed(spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT],
                          match, PAGE_FLAG_MASK))
     {
-        FAILPT("hypervisor per-domain map inconsistent saw %lx, expected (va=%p) %lx",
+        FAILPT("hypervisor per-domain map inconsistent saw %" PRIpte ", expected (va=%p) %" PRIpte,
                l2e_get_intpte(spl2e[PERDOMAIN_VIRT_START >> L2_PAGETABLE_SHIFT]),
                d->arch.mm_perdomain_pt,
                l2e_get_intpte(match));
@@ -3234,7 +3235,7 @@
 {
     struct domain *d = ed->domain;
     pagetable_t pt = ed->arch.guest_table;
-    unsigned long gptbase = pagetable_val(pt);
+    unsigned long gptbase = pagetable_get_paddr(pt);
     unsigned long ptbase_pfn, smfn;
     unsigned long i;
     l2_pgentry_t *gpl2e, *spl2e;
diff -urN orig/xen/include/asm-x86/shadow.h mod/xen/include/asm-x86/shadow.h
--- orig/xen/include/asm-x86/shadow.h	2005-06-02 09:04:14.000000000 -0700
+++ mod/xen/include/asm-x86/shadow.h	2005-06-02 09:06:04.000000000 -0700
@@ -397,7 +397,7 @@
     if ( unlikely(!res) )
     {
         perfc_incrc(shadow_get_page_fail);
-        FSH_LOG("%s failed to get ref l1e=%lx\n",
+        FSH_LOG("%s failed to get ref l1e=%" PRIpte "\n",
                 __func__, l1e_get_intpte(l1e));
     }
 
@@ -738,7 +738,7 @@
     l1e_add_flags(gpte, _PAGE_DIRTY | _PAGE_ACCESSED);
     spte = l1e_from_pfn(gmfn, l1e_get_flags(gpte) & ~_PAGE_GLOBAL);
 
-    SH_VVLOG("l1pte_write_fault: updating spte=0x%lx gpte=0x%lx",
+    SH_VVLOG("l1pte_write_fault: updating spte=0x%" PRIpte " gpte=0x%" PRIpte,
              l1e_get_intpte(spte), l1e_get_intpte(gpte));
 
     if ( shadow_mode_log_dirty(d) )
@@ -777,7 +777,7 @@
         l1e_remove_flags(spte, _PAGE_RW);
     }
 
-    SH_VVLOG("l1pte_read_fault: updating spte=0x%lx gpte=0x%lx",
+    SH_VVLOG("l1pte_read_fault: updating spte=0x%" PRIpte " gpte=0x%" PRIpte,
              l1e_get_intpte(spte), l1e_get_intpte(gpte));
     *gpte_p = gpte;
     *spte_p = spte;
@@ -809,7 +809,7 @@
     }
 
     if ( l1e_get_intpte(spte) || l1e_get_intpte(gpte) )
-        SH_VVVLOG("%s: gpte=%lx, new spte=%lx",
+        SH_VVVLOG("%s: gpte=%" PRIpte ", new spte=%" PRIpte,
                   __func__, l1e_get_intpte(gpte), l1e_get_intpte(spte));
 
     *spte_p = spte;
@@ -843,7 +843,7 @@
     }
 
     if ( l1e_get_intpte(hl2e) || l2e_get_intpte(gpde) )
-        SH_VVLOG("%s: gpde=%lx hl2e=%lx", __func__,
+        SH_VVLOG("%s: gpde=%" PRIpte " hl2e=%" PRIpte, __func__,
                  l2e_get_intpte(gpde), l1e_get_intpte(hl2e));
 
     *hl2e_p = hl2e;
@@ -872,7 +872,7 @@
     }
 
     if ( l2e_get_intpte(spde) || l2e_get_intpte(gpde) )
-        SH_VVLOG("%s: gpde=%lx, new spde=%lx", __func__,
+        SH_VVLOG("%s: gpde=%" PRIpte ", new spde=%" PRIpte, __func__,
                  l2e_get_intpte(gpde), l2e_get_intpte(spde));
 
     *spde_p = spde;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

      reply	other threads:[~2005-06-02 17:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-01 18:09 [PATCH] Fix compilation of shadow mode debugging code Michael Vrable
2005-06-02  8:07 ` Keir Fraser
2005-06-02 17:06   ` Michael Vrable [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050602170655.GA27101@vrable.net \
    --to=mvrable@cs.ucsd.edu \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.