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

[Xen-changelog] [xen-unstable] [XEN][POWERPC] Improve the debugging stra

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN][POWERPC] Improve the debugging strategy of these hcalls.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 13 Dec 2006 17:34:24 +0000
Delivery-date: Wed, 13 Dec 2006 09:35:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 4ca8abbd89c8884684dace94ad99e525490ab326
# Parent  234257c78627ad6577cc7d4124536bfbb7d64a60
[XEN][POWERPC] Improve the debugging strategy of these hcalls.
This patch cleans up all the variaus printk()s.
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/arch/powerpc/papr/xlate.c |  132 +++++++++++++++++++++---------------------
 1 files changed, 67 insertions(+), 65 deletions(-)

diff -r 234257c78627 -r 4ca8abbd89c8 xen/arch/powerpc/papr/xlate.c
--- a/xen/arch/powerpc/papr/xlate.c     Fri Sep 29 14:31:05 2006 -0400
+++ b/xen/arch/powerpc/papr/xlate.c     Sun Oct 01 08:38:38 2006 -0400
@@ -19,7 +19,7 @@
  */
 
 #undef DEBUG
-#undef DEBUG_FAIL
+#undef DEBUG_LOW
 
 #include <xen/config.h>
 #include <xen/types.h>
@@ -29,6 +29,17 @@
 #include <asm/current.h>
 #include <asm/papr.h>
 #include <asm/hcalls.h>
+
+#ifdef DEBUG
+#define DBG(fmt...) printk(fmt)
+#else
+#define DBG(fmt...)
+#endif
+#ifdef DEBUG_LOW
+#define DBG_LOW(fmt...) printk(fmt)
+#else
+#define DBG_LOW(fmt...)
+#endif
 
 #ifdef USE_PTE_INSERT
 static inline void pte_insert(union pte volatile *pte,
@@ -129,8 +140,8 @@ static void h_enter(struct cpu_user_regs
 
     htab = &d->arch.htab;
     if (ptex > (1UL << htab->log_num_ptes)) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
 
@@ -150,8 +161,8 @@ static void h_enter(struct cpu_user_regs
         }
 
         if ( lp_size >= d->arch.large_page_sizes ) {
-            printk("%s: attempt to use unsupported lp_size %d\n",
-                   __func__, lp_size);
+            DBG("%s: attempt to use unsupported lp_size %d\n",
+                __func__, lp_size);
             regs->gprs[3] = H_Parameter;
             return;
         }
@@ -168,6 +179,7 @@ static void h_enter(struct cpu_user_regs
 
     mfn = pfn2mfn(d, pfn, &mtype);
     if (mfn == INVALID_MFN) {
+        DBG("%s: Bad PFN: 0x%lx\n", __func__, pfn);
         regs->gprs[3] =  H_Parameter;
         return;
     }
@@ -175,21 +187,19 @@ static void h_enter(struct cpu_user_regs
     if (mtype == PFN_TYPE_IO) {
         /* only a privilaged dom can access outside IO space */
         if ( !d->is_privileged ) {
+            DBG("%s: unprivileged access to physical page: 0x%lx\n",
+                __func__, pfn);
             regs->gprs[3] =  H_Privilege;
-            printk("%s: unprivileged access to physical page: 0x%lx\n",
-                   __func__, pfn);
             return;
         }
 
         if ( !((pte.bits.w == 0)
              && (pte.bits.i == 1)
              && (pte.bits.g == 1)) ) {
-#ifdef DEBUG_FAIL
-            printk("%s: expecting an IO WIMG "
-                   "w=%x i=%d m=%d, g=%d\n word 0x%lx\n", __func__,
-                   pte.bits.w, pte.bits.i, pte.bits.m, pte.bits.g,
-                   pte.words.rpn);
-#endif
+            DBG("%s: expecting an IO WIMG "
+                "w=%x i=%d m=%d, g=%d\n word 0x%lx\n", __func__,
+                pte.bits.w, pte.bits.i, pte.bits.m, pte.bits.g,
+                pte.words.rpn);
             regs->gprs[3] =  H_Parameter;
             return;
         }
@@ -213,11 +223,13 @@ static void h_enter(struct cpu_user_regs
         BUG_ON(f == d);
 
         if (unlikely(!get_domain(f))) {
+            DBG("%s: Rescinded, no domain: 0x%lx\n",  __func__, pfn);
             regs->gprs[3] = H_Rescinded;
             return;
         }
         if (unlikely(!get_page(pg, f))) {
             put_domain(f);
+            DBG("%s: Rescinded, no page: 0x%lx\n",  __func__, pfn);
             regs->gprs[3] = H_Rescinded;
             return;
         }
@@ -283,10 +295,8 @@ static void h_enter(struct cpu_user_regs
         }
     }
 
-#ifdef DEBUG
     /* If the PTEG is full then no additional values are returned. */
-    printk("%s: PTEG FULL\n", __func__);
-#endif
+    DBG("%s: PTEG FULL\n", __func__);
 
     if (pg != NULL)
         put_page(pg);
@@ -308,13 +318,11 @@ static void h_protect(struct cpu_user_re
     union pte volatile *ppte;
     union pte lpte;
 
-#ifdef DEBUG
-    printk("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
-           flags, ptex, avpn);
-#endif
+    DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
+            flags, ptex, avpn);
     if ( ptex > (1UL << htab->log_num_ptes) ) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
     ppte = &htab->map[ptex];
@@ -324,10 +332,8 @@ static void h_protect(struct cpu_user_re
 
     /* the AVPN param occupies the bit-space of the word */
     if ( (flags & H_AVPN) && lpte.bits.avpn != avpn >> 7 ) {
-#ifdef DEBUG_FAIL
-        printk("%s: %p: AVPN check failed: 0x%lx, 0x%lx\n", __func__,
-                ppte, lpte.words.vsid, lpte.words.rpn);
-#endif
+        DBG("%s: %p: AVPN check failed: 0x%lx, 0x%lx\n", __func__,
+            ppte, lpte.words.vsid, lpte.words.rpn);
         regs->gprs[3] = H_Not_Found;
         return;
     }
@@ -337,9 +343,7 @@ static void h_protect(struct cpu_user_re
          * we invalidate entires where the PAPR says to 0 the whole hi
          * dword, so the AVPN should catch this first */
 
-#ifdef DEBUG_FAIL
-        printk("%s: pte invalid\n", __func__);
-#endif
+        DBG("%s: pte invalid\n", __func__);
         regs->gprs[3] =  H_Not_Found;
         return;
     }
@@ -382,20 +386,20 @@ static void h_clear_ref(struct cpu_user_
     union pte volatile *pte;
     union pte lpte;
 
+    DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
+            flags, ptex);
+
 #ifdef DEBUG
-    printk("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
-           flags, ptex);
-#endif
-
     if (flags != 0) {
-        printk("WARNING: %s: "
-                "flags are undefined and should be 0: 0x%lx\n",
-                __func__, flags);
-    }
+        DBG("WARNING: %s: "
+            "flags are undefined and should be 0: 0x%lx\n",
+            __func__, flags);
+    }
+#endif
 
     if (ptex > (1UL << htab->log_num_ptes)) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
     pte = &htab->map[ptex];
@@ -425,19 +429,20 @@ static void h_clear_mod(struct cpu_user_
     union pte volatile *pte;
     union pte lpte;
 
+    DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
+           flags, ptex);
+
 #ifdef DEBUG
-    printk("%s: flags: 0x%lx ptex: 0x%lx\n", __func__,
-           flags, ptex);
-#endif
     if (flags != 0) {
-        printk("WARNING: %s: "
-                "flags are undefined and should be 0: 0x%lx\n",
-                __func__, flags);
-    }
-    
+        DBG("WARNING: %s: "
+            "flags are undefined and should be 0: 0x%lx\n",
+            __func__, flags);
+    }
+#endif
+
     if (ptex > (1UL << htab->log_num_ptes)) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
     pte = &htab->map[ptex];
@@ -477,13 +482,12 @@ static void h_remove(struct cpu_user_reg
     union pte volatile *pte;
     union pte lpte;
 
-#ifdef DEBUG
-    printk("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
-           flags, ptex, avpn);
-#endif
+    DBG_LOW("%s: flags: 0x%lx ptex: 0x%lx avpn: 0x%lx\n", __func__,
+            flags, ptex, avpn);
+
     if ( ptex > (1UL << htab->log_num_ptes) ) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
     pte = &htab->map[ptex];
@@ -491,17 +495,13 @@ static void h_remove(struct cpu_user_reg
     lpte.words.rpn = pte->words.rpn;
 
     if ((flags & H_AVPN) && lpte.bits.avpn != (avpn >> 7)) {
-#ifdef DEBUG_FAIL
-        printk("%s: avpn doesn not match\n", __func__);
-#endif
+        DBG("%s: avpn doesn not match\n", __func__);
         regs->gprs[3] = H_Not_Found;
         return;
     }
 
     if ((flags & H_ANDCOND) && ((avpn & pte->words.vsid) != 0)) {
-#ifdef DEBUG_FAIL
-        printk("%s: andcond does not match\n", __func__);
-#endif
+        DBG("%s: andcond does not match\n", __func__);
         regs->gprs[3] = H_Not_Found;
         return;
     }
@@ -511,11 +511,13 @@ static void h_remove(struct cpu_user_reg
     regs->gprs[4] = lpte.words.vsid;
     regs->gprs[5] = lpte.words.rpn;
 
+#ifdef DEBUG_LOW
     /* XXX - I'm very skeptical of doing ANYTHING if not bits.v */
     /* XXX - I think the spec should be questioned in this case (MFM) */
     if (lpte.bits.v == 0) {
-        printk("%s: removing invalid entry\n", __func__);
-    }
+        DBG_LOW("%s: removing invalid entry\n", __func__);
+    }
+#endif
 
     if (lpte.bits.v) {
         ulong mfn = lpte.bits.rpn;
@@ -551,8 +553,8 @@ static void h_read(struct cpu_user_regs 
         ptex &= ~0x3UL;
 
     if (ptex > (1UL << htab->log_num_ptes)) {
-        regs->gprs[3] = H_Parameter;
-        printk("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        DBG("%s: bad ptex: 0x%lx\n", __func__, ptex);
+        regs->gprs[3] = H_Parameter;
         return;
     }
     pte = &htab->map[ptex];

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN][POWERPC] Improve the debugging strategy of these hcalls., Xen patchbot-unstable <=