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

From: Maciej W. Rozycki

Date: Tue Apr 07 2026 - 07:06:05 EST


On Tue, 7 Apr 2026, Stefan Wiehler wrote:

> diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
> index 24fe85fa169d..49cb5262df1e 100644
> --- a/arch/mips/mm/tlb-r4k.c
> +++ b/arch/mips/mm/tlb-r4k.c
> @@ -744,12 +745,18 @@ static void __ref r4k_tlb_uniquify_write(struct tlbent *tlb_vpns, int tlbsize)
> */
> static void __ref r4k_tlb_uniquify(void)
> {
> + unsigned int cpu = raw_smp_processor_id();
> int tlbsize = current_cpu_data.tlbsize;
> bool use_slab = slab_is_available();
> + static bool secondary = false;
> phys_addr_t tlb_vpn_size;
> struct tlbent *tlb_vpns;
>
> tlb_vpn_size = tlbsize * sizeof(*tlb_vpns);
> + if (secondary)
> + rcu_cpu_starting(cpu);
> + else
> + secondary = true;

You could use `use_slab' to figure out whether it is a secondary CPU, but
the right fix AFAICT is to reorder the `rcutree_report_cpu_starting' ahead
of `per_cpu_trap_init' in `start_secondary', possibly even to the start of
the function (does it rely on any of the initialisation done earlier on?).

NB is `rcu_cpu_starting' the right function call to make, and where does
`cpu' come from here?

Thanks for the report!

Maciej