mirror of
https://github.com/torvalds/linux.git
synced 2026-03-14 00:56:20 +01:00
cpu: Provide lockdep check for CPU hotplug lock write-held
cpuset modifies partitions, including isolated, while holding the cpu hotplug lock read-held. This means that write-holding the CPU hotplug lock is safe to synchronize against housekeeping cpumask changes. Provide a lockdep check to validate that. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Cc: Marco Crivellari <marco.crivellari@suse.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Tejun Heo <tj@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <longman@redhat.com> Cc: linux-kernel@vger.kernel.org
This commit is contained in:
parent
b5de34ed87
commit
622c508bcf
3 changed files with 7 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
struct device;
|
||||
|
||||
extern int lockdep_is_cpus_held(void);
|
||||
extern int lockdep_is_cpus_write_held(void);
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
void cpus_write_lock(void);
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ extern void percpu_free_rwsem(struct percpu_rw_semaphore *);
|
|||
__percpu_init_rwsem(sem, #sem, &rwsem_key); \
|
||||
})
|
||||
|
||||
#define percpu_rwsem_is_write_held(sem) lockdep_is_held_type(sem, 0)
|
||||
#define percpu_rwsem_is_held(sem) lockdep_is_held(sem)
|
||||
#define percpu_rwsem_assert_held(sem) lockdep_assert_held(sem)
|
||||
|
||||
|
|
|
|||
|
|
@ -534,6 +534,11 @@ int lockdep_is_cpus_held(void)
|
|||
{
|
||||
return percpu_rwsem_is_held(&cpu_hotplug_lock);
|
||||
}
|
||||
|
||||
int lockdep_is_cpus_write_held(void)
|
||||
{
|
||||
return percpu_rwsem_is_write_held(&cpu_hotplug_lock);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void lockdep_acquire_cpus_lock(void)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue