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 <mattw@codeaurora.org>
This commit is contained in:
Matt Wagantall 2015-05-20 13:43:01 -07:00 committed by Gerrit - the friendly Code Review server
parent c2b3e4d092
commit 845958d358
1 changed files with 7 additions and 5 deletions

View File

@ -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);