x86: Reduce logging about get_page_type() failures.
authorKeir Fraser <keir@xensource.com>
Wed, 17 Oct 2007 10:17:53 +0000 (11:17 +0100)
committerKeir Fraser <keir@xensource.com>
Wed, 17 Oct 2007 10:17:53 +0000 (11:17 +0100)
We shouldn't log if the cause could be a recursive-mapping attempt --
we expect a get_page_type() failure in that case.

Based on a patch maintained for NetBSD.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c

index fa6bac5a892652feac1f1682998224ef6957ecfa..285fa99310828f082563c74472397331919b7296 100644 (file)
@@ -1771,13 +1771,20 @@ int get_page_type(struct page_info *page, unsigned long type)
         }
         else if ( unlikely((x & (PGT_type_mask|PGT_pae_xen_l2)) != type) )
         {
-            if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
-                 (type != PGT_l1_page_table) )
-                MEM_LOG("Bad type (saw %" PRtype_info
-                        " != exp %" PRtype_info ") "
-                        "for mfn %lx (pfn %lx)",
-                        x, type, page_to_mfn(page),
-                        get_gpfn_from_mfn(page_to_mfn(page)));
+            /* Don't log failure if it could be a recursive-mapping attempt. */
+            if ( ((x & PGT_type_mask) == PGT_l2_page_table) &&
+                 (type == PGT_l1_page_table) )
+                return 0;
+            if ( ((x & PGT_type_mask) == PGT_l3_page_table) &&
+                 (type == PGT_l2_page_table) )
+                return 0;
+            if ( ((x & PGT_type_mask) == PGT_l4_page_table) &&
+                 (type == PGT_l3_page_table) )
+                return 0;
+            MEM_LOG("Bad type (saw %" PRtype_info " != exp %" PRtype_info ") "
+                    "for mfn %lx (pfn %lx)",
+                    x, type, page_to_mfn(page),
+                    get_gpfn_from_mfn(page_to_mfn(page)));
             return 0;
         }
         else if ( unlikely(!(x & PGT_validated)) )