x86/pagewalk: Improve print_gw()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 24 May 2016 10:56:58 +0000 (11:56 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 5 Dec 2016 14:29:00 +0000 (14:29 +0000)
print_gw() has no callers, meaning that it only gets used as part of manual
debugging.  As such, the FILE/LINE references are of no practical use, and
voluminous in the log.  Additionally, the function becoming empty in a
non-debug build is unhelpful.  Switch from gdprintk() to gprintk().

Print the entry and mfn for a specific level on the same line.  This halves
the number of lines printed overall.  There needs to be a small adjustment to
the #ifdef'ary to maintain the proper l3e behaviour for 3-level paging, where
there is no l3mfn to print.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen/include/asm-x86/guest_pt.h

index 79ed4ff561477bcdc6add347ecb1eddb24d575e0..3ec9acedd7791420cf7b314518669e5331a950d8 100644 (file)
@@ -310,21 +310,23 @@ guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m, unsigned long va,
                   walk_t *gw, uint32_t pfec, mfn_t top_mfn, void *top_map);
 
 /* Pretty-print the contents of a guest-walk */
-static inline void print_gw(walk_t *gw)
+static inline void print_gw(const walk_t *gw)
 {
-    gdprintk(XENLOG_INFO, "GUEST WALK TO %#lx:\n", gw->va);
+    gprintk(XENLOG_INFO, "GUEST WALK TO %p\n", _p(gw->va));
 #if GUEST_PAGING_LEVELS >= 3 /* PAE or 64... */
 #if GUEST_PAGING_LEVELS >= 4 /* 64-bit only... */
-    gdprintk(XENLOG_INFO, "   l4mfn=%" PRI_mfn "\n", mfn_x(gw->l4mfn));
-    gdprintk(XENLOG_INFO, "   l4e=%" PRI_gpte "\n", gw->l4e.l4);
-    gdprintk(XENLOG_INFO, "   l3mfn=%" PRI_mfn "\n", mfn_x(gw->l3mfn));
+    gprintk(XENLOG_INFO, "   l4e=%" PRI_gpte " l4mfn=%" PRI_mfn "\n",
+            gw->l4e.l4, mfn_x(gw->l4mfn));
+    gprintk(XENLOG_INFO, "   l3e=%" PRI_gpte " l3mfn=%" PRI_mfn "\n",
+            gw->l3e.l3, mfn_x(gw->l3mfn));
+#else  /* PAE only... */
+    gprintk(XENLOG_INFO, "   l3e=%" PRI_gpte "\n", gw->l3e.l3);
 #endif /* PAE or 64... */
-    gdprintk(XENLOG_INFO, "   l3e=%" PRI_gpte "\n", gw->l3e.l3);
 #endif /* All levels... */
-    gdprintk(XENLOG_INFO, "   l2mfn=%" PRI_mfn "\n", mfn_x(gw->l2mfn));
-    gdprintk(XENLOG_INFO, "   l2e=%" PRI_gpte "\n", gw->l2e.l2);
-    gdprintk(XENLOG_INFO, "   l1mfn=%" PRI_mfn "\n", mfn_x(gw->l1mfn));
-    gdprintk(XENLOG_INFO, "   l1e=%" PRI_gpte "\n", gw->l1e.l1);
+    gprintk(XENLOG_INFO, "   l2e=%" PRI_gpte " l2mfn=%" PRI_mfn "\n",
+            gw->l2e.l2, mfn_x(gw->l2mfn));
+    gprintk(XENLOG_INFO, "   l1e=%" PRI_gpte " l1mfn=%" PRI_mfn "\n",
+            gw->l1e.l1, mfn_x(gw->l1mfn));
 }
 
 #endif /* _XEN_ASM_GUEST_PT_H */