[PATCH] [26/36] CPA: Dump pagetable when inconsistency is detected

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>, <mingo@...>, <tglx@...>, <jbeulich@...>, <venkatesh.pallipadi@...>
Date: Wednesday, January 16, 2008 - 6:15 pm

When c_p_a() detects a inconsistency in the kernel page tables 
it BUGs. When this happens dump the page table first to avoid one 
bug reporting round trip.

Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Jan Beulich <jbeulich@novell.com>

---
 arch/x86/mm/pageattr_32.c |   11 ++++++++++-
 arch/x86/mm/pageattr_64.c |   11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

Index: linux/arch/x86/mm/pageattr_64.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_64.c
+++ linux/arch/x86/mm/pageattr_64.c
@@ -12,6 +12,7 @@
 #include <asm/processor.h>
 #include <asm/tlbflush.h>
 #include <asm/io.h>
+#include <asm/kdebug.h>
 
 enum flush_mode { FLUSH_NONE, FLUSH_CACHE, FLUSH_TLB };
 
@@ -231,8 +232,16 @@ __change_page_attr(unsigned long address
 		set_pte(kpte, pfn_pte(pfn, ref_prot));
 		BUG_ON(page_private(kpte_page) == 0);
 		page_private(kpte_page)--;
-	} else
+	} else {
+		/*
+		 * When you're here you either set the same page to PAGE_KERNEL
+		 * two times in a row or the page table reference counting is
+		 * broken again. To catch the later bug for now (sorry)
+		 */
+		printk(KERN_ERR "address %lx\n", address);
+		dump_pagetable(address);
 		BUG();
+	}
 
 	save_page(kpte_page);
 	if (!PageReserved(kpte_page) && page_private(kpte_page) == 0)
Index: linux/arch/x86/mm/pageattr_32.c
===================================================================
--- linux.orig/arch/x86/mm/pageattr_32.c
+++ linux/arch/x86/mm/pageattr_32.c
@@ -13,6 +13,7 @@
 #include <asm/tlbflush.h>
 #include <asm/pgalloc.h>
 #include <asm/sections.h>
+#include <asm/kdebug.h>
 
 #define PG_deferred PG_arch_1
 
@@ -252,8 +253,16 @@ __change_page_attr(struct page *page, pg
 		set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
 		BUG_ON(page_private(kpte_page) == 0);
 		page_private(kpte_page)--;
-	} else
+	} else {
+		/*
+		 * When you're here you either set the same page to PAGE_KERNEL
+		 * two times in a row or the page table reference counting is
+		 * broken again. To catch the later bug for now (sorry)
+		 */
+		printk(KERN_ERR "address %lx\n", address);
+		dump_pagetable(address);
 		BUG();
+	}
 
 	/*
 	 * If the pte was reserved, it means it was created at boot
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] [35/36] Remove set_kernel_exec, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [36/36] Clean up pte_exec, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [26/36] CPA: Dump pagetable when inconsistency is de..., Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [14/36] CPA: Add simple self test at boot, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [10/36] Add pte_pgprot on i386, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [9/36] Add pte accessors for the global bit, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [8/36] CPA: Do a simple self test at boot, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [4/36] CPA: Undo white space changes, Andi Kleen, (Wed Jan 16, 6:15 pm)
[PATCH] [1/36] Undo pat cpa patch, Andi Kleen, (Wed Jan 16, 6:14 pm)