Lockdep-RCU splat in ARM CPU hotplug

Stefan Wiehler stefan.wiehler at nokia.com
Thu Mar 7 08:01:42 PST 2024


> So I think this is down to what check_and_switch_context() is doing.
> 
> Tracing through the paths, idle_task_exit() is called from the
> arch_cpu_idle_dead() path on both 32-bit ARM and x86. So this is legal
> to do (if it wasn't then x86 would have problems.)
> 
> idle_task_exit() calls switch_mm(), which is an arch-defined function,
> and this calls check_and_switch_context(). Anything which switch_mm()
> calls has to be safe to be called from the arch_cpu_idle_dead() path.
> 
> We can't get rid of the spinlock in check_and_switch_context() as that
> is fundamental to how the ASID handling works - removing it would
> cause all sorts of races.
> 
> I don't see how we can solve this at the moment, not helped by my
> limited RCU knowledge.

I apparently misunderstood the warning; it is actually the other way
round in the sense that the CPU is reported offline from RCU perspective
too early, not too late.

I think the the false-positive Lockdep-RCU splat can be avoided by
briefly reporting the CPU as online again while the spinlock is held. I
will send a patch and also ask the RCU maintainers for a review.



More information about the linux-arm-kernel mailing list