• Stefan Wiehler's avatar
    mips/smp: Call rcutree_report_cpu_starting() earlier · 55702ec9
    Stefan Wiehler authored
    rcutree_report_cpu_starting() must be called before
    clockevents_register_device() to avoid the following lockdep splat triggered by
    calling list_add() when CONFIG_PROVE_RCU_LIST=y:
    
      WARNING: suspicious RCU usage
      ...
      -----------------------------
      kernel/locking/lockdep.c:3680 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.
      ...
      Call Trace:
      [<ffffffff8012a434>] show_stack+0x64/0x158
      [<ffffffff80a93d98>] dump_stack_lvl+0x90/0xc4
      [<ffffffff801c9e9c>] __lock_acquire+0x1404/0x2940
      [<ffffffff801cbf3c>] lock_acquire+0x14c/0x448
      [<ffffffff80aa4260>] _raw_spin_lock_irqsave+0x50/0x88
      [<ffffffff8021e0c8>] clockevents_register_device+0x60/0x1e8
      [<ffffffff80130ff0>] r4k_clockevent_init+0x220/0x3a0
      [<ffffffff801339d0>] start_secondary+0x50/0x3b8
    
    raw_smp_processor_id() is required in order to avoid calling into lockdep
    before RCU has declared the CPU to be watched for readers.
    
    See also commit 29368e09 ("x86/smpboot:  Move rcu_cpu_starting() earlier"),
    commit de5d9dae ("s390/smp: move rcu_cpu_starting() earlier") and commit
    99f070b6 ("powerpc/smp: Call rcu_cpu_starting() earlier").
    Signed-off-by: default avatarStefan Wiehler <stefan.wiehler@nokia.com>
    Reviewed-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
    Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
    55702ec9
smp.c 16.7 KB