The following commit has been merged into the core/rcu branch of tip: Commit-ID: 43759fe5a137389e94ed6d4680c3c63c17273158 Gitweb: https://git.kernel.org/tip/43759fe5a137389e94ed6d4680c3c63c17273158 Author: Frederic Weisbecker <frede...@kernel.org> AuthorDate: Wed, 11 Nov 2020 23:53:13 +01:00 Committer: Paul E. McKenney <paul...@kernel.org> CommitterDate: Wed, 06 Jan 2021 16:24:59 -08:00
cpu/hotplug: Add lockdep_is_cpus_held() This commit adds a lockdep_is_cpus_held() function to verify that the proper locks are held and that various operations are running in the correct context. Signed-off-by: Frederic Weisbecker <frede...@kernel.org> Cc: Paul E. McKenney <paul...@kernel.org> Cc: Josh Triplett <j...@joshtriplett.org> Cc: Steven Rostedt <rost...@goodmis.org> Cc: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> Cc: Lai Jiangshan <jiangshan...@gmail.com> Cc: Joel Fernandes <j...@joelfernandes.org> Cc: Neeraj Upadhyay <neer...@codeaurora.org> Cc: Thomas Gleixner <t...@linutronix.de> Cc: Boqun Feng <boqun.f...@gmail.com> Signed-off-by: Paul E. McKenney <paul...@kernel.org> --- include/linux/cpu.h | 2 ++ kernel/cpu.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/linux/cpu.h b/include/linux/cpu.h index d6428aa..3aaa068 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -111,6 +111,8 @@ static inline void cpu_maps_update_done(void) #endif /* CONFIG_SMP */ extern struct bus_type cpu_subsys; +extern int lockdep_is_cpus_held(void); + #ifdef CONFIG_HOTPLUG_CPU extern void cpus_write_lock(void); extern void cpus_write_unlock(void); diff --git a/kernel/cpu.c b/kernel/cpu.c index 4e11e91..1b6302e 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -330,6 +330,13 @@ void lockdep_assert_cpus_held(void) percpu_rwsem_assert_held(&cpu_hotplug_lock); } +#ifdef CONFIG_LOCKDEP +int lockdep_is_cpus_held(void) +{ + return percpu_rwsem_is_held(&cpu_hotplug_lock); +} +#endif + static void lockdep_acquire_cpus_lock(void) { rwsem_acquire(&cpu_hotplug_lock.dep_map, 0, 0, _THIS_IP_);