Skip to content

Commit 76b7d64

Browse files
riteshharjanimpe
authored andcommitted
book3s64/hash: Disable kfence if not early init
Enable kfence on book3s64 hash only when early init is enabled. This is because, kfence could cause the kernel linear map to be mapped at PAGE_SIZE level instead of 16M (which I guess we don't want). Also currently there is no way to - 1. Make multiple page size entries for the SLB used for kernel linear map. 2. No easy way of getting the hash slot details after the page table mapping for kernel linear setup. So even if kfence allocate the pool in late init, we won't be able to get the hash slot details in kfence linear map. Thus this patch disables kfence on hash if kfence early init is not enabled. Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/4a6eea8cfd1cd28fccfae067026bff30cbec1d4b.1729271995.git.ritesh.list@gmail.com
1 parent b5fbf7e commit 76b7d64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ static phys_addr_t kfence_pool;
410410

411411
static inline void hash_kfence_alloc_pool(void)
412412
{
413+
if (!kfence_early_init_enabled())
414+
goto err;
413415

414416
/* allocate linear map for kfence within RMA region */
415417
linear_map_kf_hash_count = KFENCE_POOL_SIZE >> PAGE_SHIFT;
@@ -1074,7 +1076,7 @@ static void __init htab_init_page_sizes(void)
10741076
bool aligned = true;
10751077
init_hpte_page_sizes();
10761078

1077-
if (!debug_pagealloc_enabled_or_kfence()) {
1079+
if (!debug_pagealloc_enabled() && !kfence_early_init_enabled()) {
10781080
/*
10791081
* Pick a size for the linear mapping. Currently, we only
10801082
* support 16M, 1M and 4K which is the default

0 commit comments

Comments
 (0)