Lines Matching refs:key
81 #define STATIC_KEY_CHECK_USE(key) WARN(!static_key_initialized, \ argument
83 __func__, (key))
125 long key; // key may be far away from the core kernel under KASLR member
140 long offset = entry->key & ~3L; in jump_entry_key()
142 return (struct static_key *)((unsigned long)&entry->key + offset); in jump_entry_key()
159 return (struct static_key *)((unsigned long)entry->key & ~3UL); in jump_entry_key()
166 return (unsigned long)entry->key & 1UL; in jump_entry_is_branch()
171 return (unsigned long)entry->key & 2UL; in jump_entry_is_init()
176 entry->key |= 2; in jump_entry_set_init()
195 static inline int static_key_count(struct static_key *key) in static_key_count() argument
197 return atomic_read(&key->enabled); in static_key_count()
200 static __always_inline bool static_key_false(struct static_key *key) in static_key_false() argument
202 if (unlikely(static_key_count(key) > 0)) in static_key_false()
207 static __always_inline bool static_key_true(struct static_key *key) in static_key_true() argument
209 if (likely(static_key_count(key) > 0)) in static_key_true()
221 static __always_inline bool static_key_false(struct static_key *key) in static_key_false() argument
223 return arch_static_branch(key, false); in static_key_false()
226 static __always_inline bool static_key_true(struct static_key *key) in static_key_true() argument
228 return !arch_static_branch(key, true); in static_key_true()
245 extern void static_key_slow_inc(struct static_key *key);
246 extern void static_key_slow_dec(struct static_key *key);
247 extern void static_key_slow_inc_cpuslocked(struct static_key *key);
248 extern void static_key_slow_dec_cpuslocked(struct static_key *key);
250 extern int static_key_count(struct static_key *key);
251 extern void static_key_enable(struct static_key *key);
252 extern void static_key_disable(struct static_key *key);
253 extern void static_key_enable_cpuslocked(struct static_key *key);
254 extern void static_key_disable_cpuslocked(struct static_key *key);
275 static __always_inline int static_key_count(struct static_key *key) in static_key_count() argument
277 return arch_atomic_read(&key->enabled); in static_key_count()
285 static __always_inline bool static_key_false(struct static_key *key) in static_key_false() argument
287 if (unlikely(static_key_count(key) > 0)) in static_key_false()
292 static __always_inline bool static_key_true(struct static_key *key) in static_key_true() argument
294 if (likely(static_key_count(key) > 0)) in static_key_true()
299 static inline void static_key_slow_inc(struct static_key *key) in static_key_slow_inc() argument
301 STATIC_KEY_CHECK_USE(key); in static_key_slow_inc()
302 atomic_inc(&key->enabled); in static_key_slow_inc()
305 static inline void static_key_slow_dec(struct static_key *key) in static_key_slow_dec() argument
307 STATIC_KEY_CHECK_USE(key); in static_key_slow_dec()
308 atomic_dec(&key->enabled); in static_key_slow_dec()
311 #define static_key_slow_inc_cpuslocked(key) static_key_slow_inc(key) argument
312 #define static_key_slow_dec_cpuslocked(key) static_key_slow_dec(key) argument
327 static inline void static_key_enable(struct static_key *key) in static_key_enable() argument
329 STATIC_KEY_CHECK_USE(key); in static_key_enable()
331 if (atomic_read(&key->enabled) != 0) { in static_key_enable()
332 WARN_ON_ONCE(atomic_read(&key->enabled) != 1); in static_key_enable()
335 atomic_set(&key->enabled, 1); in static_key_enable()
338 static inline void static_key_disable(struct static_key *key) in static_key_disable() argument
340 STATIC_KEY_CHECK_USE(key); in static_key_disable()
342 if (atomic_read(&key->enabled) != 1) { in static_key_disable()
343 WARN_ON_ONCE(atomic_read(&key->enabled) != 0); in static_key_disable()
346 atomic_set(&key->enabled, 0); in static_key_disable()
370 struct static_key key; member
374 struct static_key key; member
377 #define STATIC_KEY_TRUE_INIT (struct static_key_true) { .key = STATIC_KEY_INIT_TRUE, }
378 #define STATIC_KEY_FALSE_INIT (struct static_key_false){ .key = STATIC_KEY_INIT_FALSE, }
481 branch = !arch_static_branch(&(x)->key, true); \
483 branch = !arch_static_branch_jump(&(x)->key, true); \
493 branch = arch_static_branch_jump(&(x)->key, false); \
495 branch = arch_static_branch(&(x)->key, false); \
503 #define static_branch_likely(x) likely(static_key_enabled(&(x)->key))
504 #define static_branch_unlikely(x) unlikely(static_key_enabled(&(x)->key))
512 #define static_branch_inc(x) static_key_slow_inc(&(x)->key)
513 #define static_branch_dec(x) static_key_slow_dec(&(x)->key)
514 #define static_branch_inc_cpuslocked(x) static_key_slow_inc_cpuslocked(&(x)->key)
515 #define static_branch_dec_cpuslocked(x) static_key_slow_dec_cpuslocked(&(x)->key)
521 #define static_branch_enable(x) static_key_enable(&(x)->key)
522 #define static_branch_disable(x) static_key_disable(&(x)->key)
523 #define static_branch_enable_cpuslocked(x) static_key_enable_cpuslocked(&(x)->key)
524 #define static_branch_disable_cpuslocked(x) static_key_disable_cpuslocked(&(x)->key)