Skip to content

Commit cb53826

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
jump_label/lockdep: Assert we hold the hotplug lock for _cpuslocked() 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>
1 parent ce99109 commit cb53826

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/jump_label.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ void static_key_slow_inc_cpuslocked(struct static_key *key)
8585
int v, v1;
8686

8787
STATIC_KEY_CHECK_USE(key);
88+
lockdep_assert_cpus_held();
8889

8990
/*
9091
* Careful if we get concurrent static_key_slow_inc() calls;
@@ -130,6 +131,7 @@ EXPORT_SYMBOL_GPL(static_key_slow_inc);
130131
void static_key_enable_cpuslocked(struct static_key *key)
131132
{
132133
STATIC_KEY_CHECK_USE(key);
134+
lockdep_assert_cpus_held();
133135

134136
if (atomic_read(&key->enabled) > 0) {
135137
WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
@@ -160,6 +162,7 @@ EXPORT_SYMBOL_GPL(static_key_enable);
160162
void static_key_disable_cpuslocked(struct static_key *key)
161163
{
162164
STATIC_KEY_CHECK_USE(key);
165+
lockdep_assert_cpus_held();
163166

164167
if (atomic_read(&key->enabled) != 1) {
165168
WARN_ON_ONCE(atomic_read(&key->enabled) != 0);
@@ -185,6 +188,8 @@ static void __static_key_slow_dec_cpuslocked(struct static_key *key,
185188
unsigned long rate_limit,
186189
struct delayed_work *work)
187190
{
191+
lockdep_assert_cpus_held();
192+
188193
/*
189194
* The negative count check is valid even when a negative
190195
* key->enabled is in use by static_key_slow_inc(); a

0 commit comments

Comments
 (0)