diff options
author | Ingo Molnar <mingo@kernel.org> | 2021-09-08 23:00:50 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2022-03-15 12:57:27 +0100 |
commit | 257701598d18b0eb1401b2f065aebf8df74ca7ad (patch) | |
tree | f2cc9a4898f524fa19cb576f6066f29c9e480dd0 | |
parent | 3905fd48915d0cd9d1bfd818ca31f21b29b3890c (diff) | |
download | tip-257701598d18b0eb1401b2f065aebf8df74ca7ad.tar.gz |
headers/deps: rcu: Split out debug methods from <linux/rcupdate.h> into <linux/rcupdate_api_debug.h>
This will be useful for <linux/skbuff_api.h>.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/rcupdate.h | 47 | ||||
-rw-r--r-- | include/linux/rcupdate_api_debug.h | 56 |
2 files changed, 57 insertions, 46 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 036a6e1b555f5d..93cf8516c1c2fa 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -20,6 +20,8 @@ #ifndef __LINUX_RCUPDATE_H #define __LINUX_RCUPDATE_H +#include <linux/rcupdate_api_debug.h> + #include <linux/lockdep_api.h> #include <linux/err.h> #include <linux/bug.h> @@ -258,51 +260,6 @@ extern struct lockdep_map rcu_bh_lock_map; extern struct lockdep_map rcu_sched_lock_map; extern struct lockdep_map rcu_callback_map; -#ifdef CONFIG_DEBUG_LOCK_ALLOC - -static inline void rcu_lock_acquire(struct lockdep_map *map) -{ - lock_acquire(map, 0, 0, 2, 0, NULL, _THIS_IP_); -} - -static inline void rcu_lock_release(struct lockdep_map *map) -{ - lock_release(map, _THIS_IP_); -} - -int debug_lockdep_rcu_enabled(void); -int rcu_read_lock_held(void); -int rcu_read_lock_bh_held(void); -int rcu_read_lock_sched_held(void); -int rcu_read_lock_any_held(void); - -#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ - -# define rcu_lock_acquire(a) do { } while (0) -# define rcu_lock_release(a) do { } while (0) - -static inline int rcu_read_lock_held(void) -{ - return 1; -} - -static inline int rcu_read_lock_bh_held(void) -{ - return 1; -} - -static inline int rcu_read_lock_sched_held(void) -{ - return !preemptible(); -} - -static inline int rcu_read_lock_any_held(void) -{ - return !preemptible(); -} - -#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ - #ifdef CONFIG_PROVE_RCU /** diff --git a/include/linux/rcupdate_api_debug.h b/include/linux/rcupdate_api_debug.h index c7bc9db6721632..8d5d015e643385 100644 --- a/include/linux/rcupdate_api_debug.h +++ b/include/linux/rcupdate_api_debug.h @@ -1 +1,55 @@ -#include <linux/rcupdate.h> +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef __LINUX_RCUPDATE_API_DEBUG_H +#define __LINUX_RCUPDATE_API_DEBUG_H + +#include <linux/irqflags.h> +#include <linux/preempt.h> +#include <linux/lockdep_api.h> +#include <linux/kernel.h> + +#ifdef CONFIG_DEBUG_LOCK_ALLOC + +static inline void rcu_lock_acquire(struct lockdep_map *map) +{ + lock_acquire(map, 0, 0, 2, 0, NULL, _THIS_IP_); +} + +static inline void rcu_lock_release(struct lockdep_map *map) +{ + lock_release(map, _THIS_IP_); +} + +int debug_lockdep_rcu_enabled(void); +int rcu_read_lock_held(void); +int rcu_read_lock_bh_held(void); +int rcu_read_lock_sched_held(void); +int rcu_read_lock_any_held(void); + +#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ + +# define rcu_lock_acquire(a) do { } while (0) +# define rcu_lock_release(a) do { } while (0) + +static inline int rcu_read_lock_held(void) +{ + return 1; +} + +static inline int rcu_read_lock_bh_held(void) +{ + return 1; +} + +static inline int rcu_read_lock_sched_held(void) +{ + return !preemptible(); +} + +static inline int rcu_read_lock_any_held(void) +{ + return !preemptible(); +} + +#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ + +#endif /* __LINUX_RCUPDATE_API_DEBUG_H */ |