[RFC PATCH 6/6] powerpc/mm: Add virt_addr_valid() checks
Michael Ellerman
mpe at ellerman.id.au
Thu Apr 7 00:58:02 AEST 2022
We've had several bugs now with virt_addr_valid() being wrong, so lets
add some always-enabled boot time checks that it behaves as expected.
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
---
arch/powerpc/mm/mem.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 4d221d033804..81e9d948a8e8 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -305,6 +305,13 @@ void __init mem_init(void)
MODULES_VADDR, MODULES_END);
#endif
#endif /* CONFIG_PPC32 */
+
+ // Check virt_addr_valid() works as expected
+ WARN_ON(!virt_addr_valid(PAGE_OFFSET));
+ WARN_ON(virt_addr_valid(PAGE_OFFSET - 1));
+ WARN_ON(virt_addr_valid(high_memory));
+ WARN_ON(virt_addr_valid(VMALLOC_START));
+ WARN_ON(virt_addr_valid(VMALLOC_END - 1));
}
void free_initmem(void)
--
2.34.1
More information about the Linuxppc-dev
mailing list