Re: [tip: locking/core] lockdep: Fix lockdep recursion

From: Qian Cai
Date: Fri Oct 09 2020 - 13:54:43 EST


On Fri, 2020-10-09 at 13:36 -0400, Qian Cai wrote:
> Back to x86, we have:
>
> start_secondary()
> smp_callin()
> apic_ap_setup()
> setup_local_APIC()
> printk() in certain conditions.
>
> which is before smp_store_cpu_info().
>
> Can't we add a rcu_cpu_starting() at the very top for each start_secondary(),
> secondary_start_kernel(), smp_start_secondary() etc, so we don't worry about
> any printk() later?

This is rather irony. rcu_cpu_starting() is taking a lock and then reports
itself.

[ 8.826732][ T0] __lock_acquire.cold.76+0x2ad/0x3e0
[ 8.826732][ T0] lock_acquire+0x1c8/0x820
[ 8.826732][ T0] _raw_spin_lock_irqsave+0x30/0x50
[ 8.826732][ T0] rcu_cpu_starting+0xd0/0x2c0
[ 8.826732][ T0] start_secondary+0x10/0x2a0
[ 8.826732][ T0] secondary_startup_64_no_verify+0xb8/0xbb