Thread (5 messages) read the whole thread 5 messages, 3 authors, 2025-04-09

Re: kexec failing with KVM on Power8 baremetal host

From: Madhavan Srinivasan <maddy@linux.ibm.com>
Date: 2025-02-05 06:27:49


On 2/5/25 12:35 AM, Stefan Berger wrote:
I bisected Linux between 6.13.0 and 6.12.0 due to failing kexec on a Power8 baremetal host on 6.13.0:
Can you please attach your config, also i cant recreate this host.

Maddy
quoted hunk ↗ jump to hunk
8fec58f503b296af87ffca3898965e3054f2b616 is the first bad commit
commit 8fec58f503b296af87ffca3898965e3054f2b616
Author: Ritesh Harjani (IBM) [off-list ref]
Date:   Fri Oct 18 22:59:50 2024 +0530

    book3s64/hash: Add kfence functionality

    Now that linear map functionality of debug_pagealloc is made generic,
    enable kfence to use this generic infrastructure.

    1. Define kfence related linear map variables.
       - u8 *linear_map_kf_hash_slots;
       - unsigned long linear_map_kf_hash_count;
       - DEFINE_RAW_SPINLOCK(linear_map_kf_hash_lock);
    2. The linear map size allocated in RMA region is quite small
       (KFENCE_POOL_SIZE >> PAGE_SHIFT) which is 512 bytes by default.
    3. kfence pool memory is reserved using memblock_phys_alloc() which has
       can come from anywhere.
       (default 255 objects => ((1+255) * 2) << PAGE_SHIFT = 32MB)
    4. The hash slot information for kfence memory gets added in linear map
       in hash_linear_map_add_slot() (which also adds for debug_pagealloc).

    Reported-by: Pavithra Prakash [off-list ref]
    Signed-off-by: Ritesh Harjani (IBM) [off-list ref]
    Signed-off-by: Michael Ellerman [off-list ref]
    Link: https://patch.msgid.link/5c2b61941b344077a2b8654dab46efa0322af3af.1729271995.git.ritesh.list@gmail.com

 arch/powerpc/include/asm/kfence.h     |   5 ---
 arch/powerpc/mm/book3s64/hash_utils.c | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 149 insertions(+), 18 deletions(-)


Reverting part of this patch by applying the following changes to 6.13.0 resolves the issue:

diff --git a/arch/powerpc/include/asm/kfence.h b/arch/powerpc/include/asm/kfence.h
index 1f7cab58ab2c..e7981719313c 100644
--- a/arch/powerpc/include/asm/kfence.h
+++ b/arch/powerpc/include/asm/kfence.h
@@ -10,6 +10,7 @@
 #include <linux/mm.h>
 #include <asm/pgtable.h>
+#include <asm/mmu.h>

 #ifdef CONFIG_PPC64_ELF_ABI_V1
 #define ARCH_FUNC_PREFIX "."
@@ -25,6 +26,10 @@ static inline void disable_kfence(void)
 static inline bool arch_kfence_init_pool(void)
 {
+#ifdef CONFIG_PPC64
+       if (!radix_enabled())
+               return false;
+#endif
        return !kfence_disabled;
 }

  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help