powerpc: Don't call lockdep_assert_cpus_held() from arch_update_cpu_topology()
authorThiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Thu, 5 Oct 2017 00:04:30 +0000 (21:04 -0300)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 10 Oct 2017 10:02:04 +0000 (21:02 +1100)
commit6b2c08f989250c54f31b53dba9ace863a1f3fff6
tree445f7130835ebbfbf135e503ebd59edbeaa2eb98
parentb0490a04e736356e427e227902b17f9927a56caf
powerpc: Don't call lockdep_assert_cpus_held() from arch_update_cpu_topology()

It turns out that not all paths calling arch_update_cpu_topology() hold
cpu_hotplug_lock, but that's OK because those paths can't race with
any concurrent hotplug events.

Warnings were reported with the following trace:

  lockdep_assert_cpus_held
  arch_update_cpu_topology
  sched_init_domains
  sched_init_smp
  kernel_init_freeable
  kernel_init
  ret_from_kernel_thread

Which is safe because it's called early in boot when hotplug is not
live yet.

And also this trace:

  lockdep_assert_cpus_held
  arch_update_cpu_topology
  partition_sched_domains
  cpuset_update_active_cpus
  sched_cpu_deactivate
  cpuhp_invoke_callback
  cpuhp_down_callbacks
  cpuhp_thread_fun
  smpboot_thread_fn
  kthread
  ret_from_kernel_thread

Which is safe because it's called as part of CPU hotplug, so although
we don't hold the CPU hotplug lock, there is another thread driving
the CPU hotplug operation which does hold the lock, and there is no
race.

Thanks to tglx for deciphering it for us.

Fixes: 3e401f7a2e51 ("powerpc: Only obtain cpu_hotplug_lock if called by rtasd")
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/numa.c