From 845958d358adfbee103c81e12d1c1ad858dce717 Mon Sep 17 00:00:00 2001 From: Matt Wagantall Date: Wed, 20 May 2015 13:43:01 -0700 Subject: [PATCH] mm/debug-pagealloc.c: print page physical address for detected corruption It's sometimes useful to know the physical address which has beencorrupted, especially in systems with multiple bus masters and DMA engines the capability of writing to memory. It's may also be useful for identifying the location of failures of memory cells in cases of device-specific corruption. Print the physical start address of the page to help in these scenarios. Change-Id: I081edd8b1c06913c0057a6cb9dda18077cfbdc30 Signed-off-by: Matt Wagantall --- mm/debug-pagealloc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c index 87dde3682f5e..f91d9b52e22e 100644 --- a/mm/debug-pagealloc.c +++ b/mm/debug-pagealloc.c @@ -54,7 +54,8 @@ static bool single_bit_flip(unsigned char a, unsigned char b) return error && !(error & (error - 1)); } -static void check_poison_mem(unsigned char *mem, size_t bytes) +static void check_poison_mem(struct page *page, + unsigned char *mem, size_t bytes) { static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10); unsigned char *start; @@ -72,10 +73,11 @@ static void check_poison_mem(unsigned char *mem, size_t bytes) if (!__ratelimit(&ratelimit)) return; else if (start == end && single_bit_flip(*start, PAGE_POISON)) - printk(KERN_ERR "pagealloc: single bit error\n"); + printk(KERN_ERR "pagealloc: single bit error on page with phys start 0x%lx\n", + (unsigned long)page_to_phys(page)); else - printk(KERN_ERR "pagealloc: memory corruption\n"); - + printk(KERN_ERR "pagealloc: memory corruption on page with phys start 0x%lx\n", + (unsigned long)page_to_phys(page)); print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, start, end - start + 1, 1); BUG_ON(PANIC_CORRUPTION); @@ -90,7 +92,7 @@ static void unpoison_page(struct page *page) return; addr = kmap_atomic(page); - check_poison_mem(addr, PAGE_SIZE); + check_poison_mem(page, addr, PAGE_SIZE); mark_addr_rdwrite(addr); clear_page_poison(page); kunmap_atomic(addr);