Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26ee6abd authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "debug-pagealloc: print physical address for detected corruption" into msm-4.9

parents 056d70b4 87f42026
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -106,7 +106,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;
@@ -127,9 +128,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);
@@ -145,7 +148,7 @@ static void unpoison_page(struct page *page)
		return;
		return;


	addr = kmap_atomic(page);
	addr = kmap_atomic(page);
	check_poison_mem(addr, PAGE_SIZE);
	check_poison_mem(page, addr, PAGE_SIZE);
	clear_page_poison(page);
	clear_page_poison(page);
	kunmap_atomic(addr);
	kunmap_atomic(addr);
}
}