Skip to content

Commit 47780e7

Browse files
riteshharjanimpe
authored andcommitted
book3s64/hash: Remove kfence support temporarily
Kfence on book3s Hash on pseries is anyways broken. It fails to boot due to RMA size limitation. That is because, kfence with Hash uses debug_pagealloc infrastructure. debug_pagealloc allocates linear map for entire dram size instead of just kfence relevant objects. This means for 16TB of DRAM it will require (16TB >> PAGE_SHIFT) which is 256MB which is half of RMA region on P8. crash kernel reserves 256MB and we also need 2048 * 16KB * 3 for emergency stack and some more for paca allocations. That means there is not enough memory for reserving the full linear map in the RMA region, if the DRAM size is too big (>=16TB) (The issue is seen above 8TB with crash kernel 256 MB reservation). Now Kfence does not require linear memory map for entire DRAM. It only needs for kfence objects. So this patch temporarily removes the kfence functionality since debug_pagealloc code needs some refactoring. We will bring in kfence on Hash support in later patches. Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/1761bc39674473c8878dedca15e0d9a0d3a1b528.1729271995.git.ritesh.list@gmail.com
1 parent 06dbbb4 commit 47780e7

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

arch/powerpc/include/asm/kfence.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <linux/mm.h>
1212
#include <asm/pgtable.h>
13+
#include <asm/mmu.h>
1314

1415
#ifdef CONFIG_PPC64_ELF_ABI_V1
1516
#define ARCH_FUNC_PREFIX "."
@@ -25,6 +26,10 @@ static inline void disable_kfence(void)
2526

2627
static inline bool arch_kfence_init_pool(void)
2728
{
29+
#ifdef CONFIG_PPC64
30+
if (!radix_enabled())
31+
return false;
32+
#endif
2833
return !kfence_disabled;
2934
}
3035
#endif

arch/powerpc/mm/book3s64/hash_utils.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
431431
break;
432432

433433
cond_resched();
434-
if (debug_pagealloc_enabled_or_kfence() &&
434+
if (debug_pagealloc_enabled() &&
435435
(paddr >> PAGE_SHIFT) < linear_map_hash_count)
436436
linear_map_hash_slots[paddr >> PAGE_SHIFT] = ret | 0x80;
437437
}
@@ -814,7 +814,7 @@ static void __init htab_init_page_sizes(void)
814814
bool aligned = true;
815815
init_hpte_page_sizes();
816816

817-
if (!debug_pagealloc_enabled_or_kfence()) {
817+
if (!debug_pagealloc_enabled()) {
818818
/*
819819
* Pick a size for the linear mapping. Currently, we only
820820
* support 16M, 1M and 4K which is the default
@@ -1134,7 +1134,7 @@ static void __init htab_initialize(void)
11341134

11351135
prot = pgprot_val(PAGE_KERNEL);
11361136

1137-
if (debug_pagealloc_enabled_or_kfence()) {
1137+
if (debug_pagealloc_enabled()) {
11381138
linear_map_hash_count = memblock_end_of_DRAM() >> PAGE_SHIFT;
11391139
linear_map_hash_slots = memblock_alloc_try_nid(
11401140
linear_map_hash_count, 1, MEMBLOCK_LOW_LIMIT,
@@ -2120,7 +2120,7 @@ void hpt_do_stress(unsigned long ea, unsigned long hpte_group)
21202120
}
21212121
}
21222122

2123-
#if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
2123+
#ifdef CONFIG_DEBUG_PAGEALLOC
21242124
static DEFINE_RAW_SPINLOCK(linear_map_hash_lock);
21252125

21262126
static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
@@ -2194,7 +2194,13 @@ int hash__kernel_map_pages(struct page *page, int numpages, int enable)
21942194
local_irq_restore(flags);
21952195
return 0;
21962196
}
2197-
#endif /* CONFIG_DEBUG_PAGEALLOC || CONFIG_KFENCE */
2197+
#else /* CONFIG_DEBUG_PAGEALLOC */
2198+
int hash__kernel_map_pages(struct page *page, int numpages,
2199+
int enable)
2200+
{
2201+
return 0;
2202+
}
2203+
#endif /* CONFIG_DEBUG_PAGEALLOC */
21982204

21992205
void hash__setup_initial_memory_limit(phys_addr_t first_memblock_base,
22002206
phys_addr_t first_memblock_size)

0 commit comments

Comments
 (0)