Skip to content

Commit

Permalink
jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked()…
Browse files Browse the repository at this point in the history
… operations

Weirdly we seem to have forgotten this...

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Sep 10, 2018
1 parent ce99109 commit cb53826
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void static_key_slow_inc_cpuslocked(struct static_key *key)
int v, v1;

STATIC_KEY_CHECK_USE(key);
lockdep_assert_cpus_held();

/*
* Careful if we get concurrent static_key_slow_inc() calls;
Expand Down Expand Up @@ -130,6 +131,7 @@ EXPORT_SYMBOL_GPL(static_key_slow_inc);
void static_key_enable_cpuslocked(struct static_key *key)
{
STATIC_KEY_CHECK_USE(key);
lockdep_assert_cpus_held();

if (atomic_read(&key->enabled) > 0) {
WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
Expand Down Expand Up @@ -160,6 +162,7 @@ EXPORT_SYMBOL_GPL(static_key_enable);
void static_key_disable_cpuslocked(struct static_key *key)
{
STATIC_KEY_CHECK_USE(key);
lockdep_assert_cpus_held();

if (atomic_read(&key->enabled) != 1) {
WARN_ON_ONCE(atomic_read(&key->enabled) != 0);
Expand All @@ -185,6 +188,8 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key,
unsigned long rate_limit,
struct delayed_work *work)
{
lockdep_assert_cpus_held();

/*
* The negative count check is valid even when a negative
* key->enabled is in use by static_key_slow_inc(); a
Expand Down

0 comments on commit cb53826

Please sign in to comment.