Re: [PATCH 09/19] arm64: smp: Defer RCU registration during secondary CPU bringup
From: Jinjie Ruan <hidden>
Date: 2026-09-08 08:56:04
Also in:
lkml
在 2026/9/8 0:40, Will Deacon 写道:
quoted hunk ↗ jump to hunk
Calling rcutree_report_cpu_starting() early during boot can lead to livelocks with the generic CPU hotplug mechanism if the boot CPU blocks on an RCU grace period while the CPU being onlined is spinning in cpuhp_ap_sync_alive(). In preparation for enabling the generic CPU hotplug code on arm64, split up the trace_hardirqs_off() call during secondary CPU bringup so that we update lockdep early but defer the tracing updates until after notify_cpu_starting() has registered the new CPU with RCU, allowing us to drop the explicit call to rcutree_report_cpu_starting() entirely. Signed-off-by: Will Deacon <will@kernel.org> --- arch/arm64/kernel/smp.c | 5 ++--- include/linux/rcutree.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index f4cabf9e19e6..ff68640d0c0b 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c@@ -217,8 +217,7 @@ asmlinkage notrace void secondary_start_kernel(void) if (system_uses_irq_prio_masking()) init_gic_priority_masking(); - rcutree_report_cpu_starting(cpu); - trace_hardirqs_off();
Hi Will,
I think we need to handle the printk problem before this patch as we
discussed earlier.
Otherwise defer the rcutree_report_cpu_starting() will trigger a
false-positive lockdep"suspicious RCU usage" splat during early lock
acquisitions as commit ce3d31ad3cac ("arm64/smp: Move
rcu_cpu_starting() earlier") pointed out.
Link:
https://lore.kernel.org/all/483e471d-d51b-4991-98d8-c0b4a2cdf8d8@huawei.com/ (local)
Best regards,
Jinjie
quoted hunk ↗ jump to hunk
+ lockdep_hardirqs_off(CALLER_ADDR0); /* * If the system has established the capabilities, make sure@@ -242,6 +241,7 @@ asmlinkage notrace void secondary_start_kernel(void) * Enable GIC and timers. */ notify_cpu_starting(cpu); + trace_hardirqs_off_finish(); ipi_setup(cpu);@@ -411,7 +411,6 @@ void __noreturn cpu_die_early(void) /* Mark this CPU absent */ set_cpu_present(cpu, 0); - rcutree_report_cpu_dead(); if (IS_ENABLED(CONFIG_HOTPLUG_CPU)) { update_cpu_boot_status(CPU_KILL_ME);diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index 16a04202888b..e6ad4f2a475c 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h@@ -116,7 +116,7 @@ int rcutree_offline_cpu(unsigned int cpu); void rcutree_migrate_callbacks(int cpu); -/* Called from hotplug and also arm64 early secondary boot failure */ +/* Called from hotplug */ void rcutree_report_cpu_dead(void); #endif /* __LINUX_RCUTREE_H */