Re: [PATCH v2] mips: mm: Call rcutree_report_cpu_starting() even earlier

From: Huacai Chen

Date: Sat Apr 11 2026 - 04:52:58 EST


Hi, Stefan,

On Fri, Apr 10, 2026 at 12:51 AM Stefan Wiehler
<stefan.wiehler@xxxxxxxxx> wrote:
>
> rcutree_report_cpu_starting() must be called on secondary CPUs before
> allocating memory to avoid the following Lockdep-RCU splat when
> CONFIG_PROVE_RCU_LIST=y:
>
> WARNING: suspicious RCU usage
> 6.6.119-00d46e15c416-fct #1 Not tainted
> -----------------------------
> /kernel/locking/lockdep.c:3762 RCU-list traversed in non-reader section!!
>
> other info that might help us debug this:
>
> RCU used illegally from offline CPU!
> rcu_scheduler_active = 1, debug_locks = 1
> no locks held by swapper/1/0.
>
> stack backtrace:
> CPU: 1 PID: 0 Comm: swapper/1 Not tainted 6.6.119-00d46e15c416-fct #1
> Stack : 80000000029e37d8 0000000000000000 0000000000000008 80000000029e37e8
> 80000000029e37e8 80000000029e3978 0000000000000000 0000000000000000
> 0000000000000000 0000000000000001 ffffffff80d9df38 ffffffff810e19c0
> 0000000000000000 0000000000000010 ffffffff80a7d140 0000000000000000
> ffffffff81c20814 0000000000000000 ffffffff80da0000 0000000000000000
> ffffffff80cadf38 0000000000000000 0000000000000000 80000000029ab680
> 72f093276415c1f3 ffffffff81c2084f ffffffff80da0000 ffffffffc0149ed8
> fffffffffffffffe 80000000029e0000 80000000029e37e0 80000000029abf58
> ffffffff80129fb0 0000000000000000 0000000000000000 0000000000000000
> 0000000000000000 0000000000000000 ffffffff80129fd0 0000000000000000
> ...
> Call Trace:
> [<ffffffff80129fd0>] show_stack+0x60/0x158
> [<ffffffff80a8cd84>] dump_stack_lvl+0x88/0xbc
> [<ffffffff801c78f8>] lockdep_rcu_suspicious+0x1c0/0x240
> [<ffffffff801cc80c>] __lock_acquire+0x121c/0x29d8
> [<ffffffff801ce14c>] lock_acquire+0x184/0x448
> [<ffffffff80a9ba30>] _raw_spin_lock_irqsave+0x50/0x90
> [<ffffffff80367038>] ___slab_alloc+0xa08/0x1808
> [<ffffffff80367e70>] __slab_alloc.isra.0+0x38/0x78
> [<ffffffff8036b7d4>] __kmem_cache_alloc_node+0x35c/0x370
> [<ffffffff80308ed8>] __kmalloc+0x58/0xd0
> [<ffffffff80a8f064>] r4k_tlb_uniquify+0x7c/0x428
> [<ffffffff80143e8c>] tlb_init+0x7c/0x110
> [<ffffffff8012bdb4>] per_cpu_trap_init+0x16c/0x1d0
> [<ffffffff80133258>] start_secondary+0x28/0x128
>
> See also commit 55702ec9603e ("mips/smp: Call
> rcutree_report_cpu_starting() earlier").
>
> Fixes: 231ac951faba ("MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow")
> Signed-off-by: Stefan Wiehler <stefan.wiehler@xxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
> V1 -> V2: Reorder rcutree_report_cpu_starting() call in
> start_secondary(), fix function name
>
> v1: https://patchwork.kernel.org/project/linux-mips/patch/20260407083324.906742-2-stefan.wiehler@xxxxxxxxx/
> ---
> arch/mips/kernel/smp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
> index 4868e79f3b30..bdb47c70d4f5 100644
> --- a/arch/mips/kernel/smp.c
> +++ b/arch/mips/kernel/smp.c
> @@ -359,8 +359,8 @@ asmlinkage void start_secondary(void)
> unsigned int cpu = raw_smp_processor_id();
>
> cpu_probe();
> - per_cpu_trap_init(false);
> rcutree_report_cpu_starting(cpu);
> + per_cpu_trap_init(false);
Please see 5056c596c3d1848021a4eaa76ee42f4c05c50346 ("LoongArch/smp:
Call rcutree_report_cpu_starting() at tlb_init()"), maybe MIPS will
have similar issues.

Huacai

> mips_clockevent_init();
> mp_ops->init_secondary();
> cpu_report();
> --
> 2.42.0
>
>