Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/mm/book3s64: Move kfence and debug_pagealloc related calls to __init section

Move a few kfence and debug_pagealloc related functions in hash_utils.c
and radix_pgtable.c to __init sections since these are only invoked once
by an __init function during system initialization.

i.e.
- hash_debug_pagealloc_alloc_slots()
- hash_kfence_alloc_pool()
- hash_kfence_map_pool()
The above 3 functions only gets called by __init htab_initialize().

- alloc_kfence_pool()
- map_kfence_pool()
The above 2 functions only gets called by __init radix_init_pgtable()

This should also help fix warning msgs like:

>> WARNING: modpost: vmlinux: section mismatch in reference:
hash_debug_pagealloc_alloc_slots+0xb0 (section: .text) ->
memblock_alloc_try_nid (section: .init.text)

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202504190552.mnFGs5sj-lkp@intel.com/
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Link: https://lore.kernel.org/r/20250717232519.2984886-8-kees@kernel.org
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Ritesh Harjani (IBM) and committed by
Kees Cook
645d1b66 437641a7

+5 -5
+3 -3
arch/powerpc/mm/book3s64/hash_utils.c
··· 343 343 static u8 *linear_map_hash_slots; 344 344 static unsigned long linear_map_hash_count; 345 345 static DEFINE_RAW_SPINLOCK(linear_map_hash_lock); 346 - static void hash_debug_pagealloc_alloc_slots(void) 346 + static __init void hash_debug_pagealloc_alloc_slots(void) 347 347 { 348 348 if (!hash_supports_debug_pagealloc()) 349 349 return; ··· 409 409 410 410 static phys_addr_t kfence_pool; 411 411 412 - static inline void hash_kfence_alloc_pool(void) 412 + static __init void hash_kfence_alloc_pool(void) 413 413 { 414 414 if (!kfence_early_init_enabled()) 415 415 goto err; ··· 445 445 disable_kfence(); 446 446 } 447 447 448 - static inline void hash_kfence_map_pool(void) 448 + static __init void hash_kfence_map_pool(void) 449 449 { 450 450 unsigned long kfence_pool_start, kfence_pool_end; 451 451 unsigned long prot = pgprot_val(PAGE_KERNEL);
+2 -2
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 363 363 } 364 364 365 365 #ifdef CONFIG_KFENCE 366 - static inline phys_addr_t alloc_kfence_pool(void) 366 + static __init phys_addr_t alloc_kfence_pool(void) 367 367 { 368 368 phys_addr_t kfence_pool; 369 369 ··· 393 393 return 0; 394 394 } 395 395 396 - static inline void map_kfence_pool(phys_addr_t kfence_pool) 396 + static __init void map_kfence_pool(phys_addr_t kfence_pool) 397 397 { 398 398 if (!kfence_pool) 399 399 return;