Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Stacktrace points to llc_mask being null.
NIP [c000000000e58504] _find_first_bit+0x44/0x130
LR [c000000000e58500] _find_first_bit+0x40/0x130
Call Trace:
build_sched_domains+0xad8/0xe50
sched_init_smp+0xa8/0x164
kernel_init_freeable+0x250/0x370
ret_from_kernel_user_thread+0x14/0x1c
On powerpc, cpu_coregroup_mask is available only when the underlying
hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
coregroup isn't supported. In such cases llc_mask was being referenced
when it was null leading to panic.
On powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
domain point to LLC is wrong. Provide a way for archs to say where its
LLC is if it not at MC domain.
Based on tip/master at 5c89783224e9 ("Merge branch into tip/master: 'x86/tdx'")
Cc: stable@vger.kernel.org
Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Reported-by: Venkat Rao Bagalkote <redacted>
Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Venkat Rao Bagalkote <redacted>
Tested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Co-developed-by: Chen, Yu C <yu.c.chen@intel.com>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
arch/powerpc/include/asm/topology.h | 6 ++++++
kernel/sched/topology.c | 13 +++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
@@ -135,6 +135,12 @@ struct cpumask *cpu_coregroup_mask(int cpu);conststructcpumask*cpu_die_mask(intcpu);intcpu_die_id(intcpu);+/* Points to where the LLC is. On power9 this will point at CACHE+*domain,OnothersitwillpointtoSMTdomain.Inallcases+*cpu_l2_cache_maskpointstowhereLLCis+*/+#define arch_llc_mask(cpu) cpu_l2_cache_mask(cpu)+#ifdef CONFIG_PPC64#include<asm/smp.h>
From: Peter Zijlstra <peterz@infradead.org> Date: 2026-05-29 09:18:12
On Fri, May 29, 2026 at 01:27:12PM +0530, Shrikanth Hegde wrote:
Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Stacktrace points to llc_mask being null.
NIP [c000000000e58504] _find_first_bit+0x44/0x130
LR [c000000000e58500] _find_first_bit+0x40/0x130
Call Trace:
build_sched_domains+0xad8/0xe50
sched_init_smp+0xa8/0x164
kernel_init_freeable+0x250/0x370
ret_from_kernel_user_thread+0x14/0x1c
On powerpc, cpu_coregroup_mask is available only when the underlying
hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
coregroup isn't supported. In such cases llc_mask was being referenced
when it was null leading to panic.
On powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
domain point to LLC is wrong. Provide a way for archs to say where its
LLC is if it not at MC domain.
Based on tip/master at 5c89783224e9 ("Merge branch into tip/master: 'x86/tdx'")
Cc: stable@vger.kernel.org
This seems unwarranted, the patch breaking stuff is in tip:sched/core.
Venkat Reported a boot kernel panic next-20260522. Git bisect pointed to
b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Stacktrace points to llc_mask being null.
NIP [c000000000e58504] _find_first_bit+0x44/0x130
LR [c000000000e58500] _find_first_bit+0x40/0x130
Call Trace:
build_sched_domains+0xad8/0xe50
sched_init_smp+0xa8/0x164
kernel_init_freeable+0x250/0x370
ret_from_kernel_user_thread+0x14/0x1c
On powerpc, cpu_coregroup_mask is available only when the underlying
hardware support coregroup. In shared LPAR, QEMU guest or power9 etc
coregroup isn't supported. In such cases llc_mask was being referenced
when it was null leading to panic.
On powerpc, LLC is at SMT core level. So assumption that coregroup(MC)
domain point to LLC is wrong. Provide a way for archs to say where its
LLC is if it not at MC domain.
Based on tip/master at 5c89783224e9 ("Merge branch into tip/master: 'x86/tdx'")
Cc: stable@vger.kernel.org
Fixes: b5ea300a17e3 ("sched/cache: Make LLC id continuous")
Reported-by: Venkat Rao Bagalkote <redacted>
Closes: https://lore.kernel.org/all/51154de7-3700-4cb4-82f2-1b3a8fa427f7@linux.ibm.com/
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: Venkat Rao Bagalkote <redacted>
Tested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Co-developed-by: Chen, Yu C <yu.c.chen@intel.com>
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
arch/powerpc/include/asm/topology.h | 6 ++++++
kernel/sched/topology.c | 13 +++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
@@ -135,6 +135,12 @@ struct cpumask *cpu_coregroup_mask(int cpu);conststructcpumask*cpu_die_mask(intcpu);intcpu_die_id(intcpu);+/* Points to where the LLC is. On power9 this will point at CACHE+*domain,OnothersitwillpointtoSMTdomain.Inallcases+*cpu_l2_cache_maskpointstowhereLLCis+*/
Nit: Regular comment style could have been better.
Instead of having another define, could we have modified current users of
llc_mask() to arch_llc_mask()? Again its not a problem, but why have 2
defines since both point to the same thing.