debug-pagealloc: print 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. So print the physical start address of the page to help in these scenarios. Change-Id: I081edd8b1c06913c0057a6cb9dda18077cfbdc30 Signed-off-by: Matt Wagantall <mattw@codeaurora.org> Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
This commit is contained in:
parent
0afd6cbeae
commit
096d47461c
@ -64,7 +64,8 @@ static bool single_bit_flip(unsigned char a, unsigned char b)
|
|||||||
return error && !(error & (error - 1));
|
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);
|
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 10);
|
||||||
unsigned char *start;
|
unsigned char *start;
|
||||||
@ -85,9 +86,11 @@ static void check_poison_mem(unsigned char *mem, size_t bytes)
|
|||||||
if (!__ratelimit(&ratelimit))
|
if (!__ratelimit(&ratelimit))
|
||||||
return;
|
return;
|
||||||
else if (start == end && single_bit_flip(*start, PAGE_POISON))
|
else if (start == end && single_bit_flip(*start, PAGE_POISON))
|
||||||
pr_err("pagealloc: single bit error\n");
|
pr_err("pagealloc: single bit error on page with phys start 0x%lx\n",
|
||||||
|
(unsigned long)page_to_phys(page));
|
||||||
else
|
else
|
||||||
pr_err("pagealloc: memory corruption\n");
|
pr_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,
|
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_ADDRESS, 16, 1, start,
|
||||||
end - start + 1, 1);
|
end - start + 1, 1);
|
||||||
@ -104,7 +107,7 @@ static void unpoison_page(struct page *page)
|
|||||||
* that is freed to buddy. Thus no extra check is done to
|
* that is freed to buddy. Thus no extra check is done to
|
||||||
* see if a page was poisoned.
|
* see if a page was poisoned.
|
||||||
*/
|
*/
|
||||||
check_poison_mem(addr, PAGE_SIZE);
|
check_poison_mem(page, addr, PAGE_SIZE);
|
||||||
kunmap_atomic(addr);
|
kunmap_atomic(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user