rcu: make rcu_read_lock_bh_held() allow for disabled BH
PATCH 1/1 rcu: make rcu_read_lock_bh_held() allow for disabled BH
Disabling BH can stand in for rcu_read_lock_bh(), and this patch updates rcu_read_lock_bh_held() to allow for this. In order to avoid include-file hell, this function is moved out of line to kernel/rcupdate.c.
--- include/linux/rcupdate.h | 19 ++++--------------- kernel/rcupdate.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 15 deletions(-)
include/linux/rcupdate.h +4 -15
@@ -123,22 +123,11 @@ static inline int rcu_read_lock_held(void)return lock_is_held (&rcu_lock_map); } -/** -* rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section? -* -* If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in -* an RCU-bh read-side critical section. In absence of CONFIG_PROVE_LOCKING, -* this assumes we are in an RCU-bh read-side critical section unless it can -* prove otherwise. -* -* Check rcu_scheduler_active to prevent false positives during boot. +/* +* rcu_read_lock_bh_held() is defined out of line to avoid #include-file +* hell. */ -static inline int rcu_read_lock_bh_held (void ) -{ -if (!debug_lockdep_rcu_enabled ()) -return 1 ; -return lock_is_held (&rcu_bh_lock_map); -} +extern int rcu_read_lock_bh_held (void );/** * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
kernel/rcupdate.c +23 -0
@@ -45,6 +45,7 @@#include <linux/mutex.h> #include <linux/module.h> #include <linux/kernel_stat.h> +#include <linux/hardirq.h> #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key rcu_lock_key;
@@ -66,6 +67,28 @@ EXPORT_SYMBOL_GPL(rcu_sched_lock_map);int rcu_scheduler_active__read_mostly ;EXPORT_SYMBOL_GPL (rcu_scheduler_active); +#ifdef CONFIG_DEBUG_LOCK_ALLOC + +/** +* rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section? +* +* Check for bottom half being disabled, which covers both the +* CONFIG_PROVE_RCU and not cases. Note that if someone uses +* rcu_read_lock_bh(), but then later enables BH, lockdep (if enabled) +* will show the situation. +* +* Check debug_lockdep_rcu_enabled() to prevent false positives during boot. +*/ +int rcu_read_lock_bh_held (void ) +{ +if (!debug_lockdep_rcu_enabled ()) +return 1 ; +return in_softirq (); +} +EXPORT_SYMBOL_GPL (rcu_read_lock_bh_held); + +#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ +/* * This function is invoked towards the end of the scheduler's initialization * process. Before this is called, the idle task might contain
Signature · 1 line
1.6.6
Quoted 7 lines · Paul E. McKenney
Disabling BH can stand in for
rcu_read_lock_bh(), and this patch updatesrcu_read_lock_bh_held()to allow for this. In order to avoid include-file hell, this function is moved out of line tokernel/rcupdate.c.Reported-by Arnd Bergmann <[email protected]>Reported-by Eric Dumazet <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>
Ingo Molnar
AppliedQuoted 10 lines · Lai Jiangshan
Quoted 7 lines · Paul E. McKenney
Disabling BH can stand in for
rcu_read_lock_bh(), and this patch updatesrcu_read_lock_bh_held()to allow for this. In order to avoid include-file hell, this function is moved out of line tokernel/rcupdate.c.Reported-by Arnd Bergmann <[email protected]>Reported-by Eric Dumazet <[email protected]>Signed-off-by Paul E. McKenney <[email protected]>Acked-by Lai Jiangshan <[email protected]>
Applied, thanks!
Ingo
[tip:core/urgent] rcu: Make rcu_read_lock_bh_held() allow for disabled BH
In reply to Paul E. McKenneyCommit-ID: e3818b8dce2a934cd1521dbc4827e5238d8f45d8 Gitweb: http://git.kernel.org/tip/e3818b8dce2a934cd1521dbc4827e5238d8f45d8 Author: Paul E. McKenney <[email protected]> AuthorDate: Mon, 15 Mar 2010 17:03:43 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 16 Mar 2010 09:57:49 +0100
rcu: Make rcu_read_lock_bh_held() allow for disabled BH
Disabling BH can stand in for rcu_read_lock_bh(), and this patch updates rcu_read_lock_bh_held() to allow for this. In order to avoid include-file hell, this function is moved out of line to kernel/rcupdate.c.
This fixes a false positive RCU warning.
LKML-Reference: <[email protected]>
--- include/linux/rcupdate.h | 19 ++++--------------- kernel/rcupdate.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 15 deletions(-)
include/linux/rcupdate.h +4 -15
@@ -123,22 +123,11 @@ static inline int rcu_read_lock_held(void)return lock_is_held (&rcu_lock_map); } -/** -* rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section? -* -* If CONFIG_PROVE_LOCKING is selected and enabled, returns nonzero iff in -* an RCU-bh read-side critical section. In absence of CONFIG_PROVE_LOCKING, -* this assumes we are in an RCU-bh read-side critical section unless it can -* prove otherwise. -* -* Check rcu_scheduler_active to prevent false positives during boot. +/* +* rcu_read_lock_bh_held() is defined out of line to avoid #include-file +* hell. */ -static inline int rcu_read_lock_bh_held (void ) -{ -if (!debug_lockdep_rcu_enabled ()) -return 1 ; -return lock_is_held (&rcu_bh_lock_map); -} +extern int rcu_read_lock_bh_held (void );/** * rcu_read_lock_sched_held - might we be in RCU-sched read-side critical section?
kernel/rcupdate.c +23 -0
@@ -45,6 +45,7 @@#include <linux/mutex.h> #include <linux/module.h> #include <linux/kernel_stat.h> +#include <linux/hardirq.h> #ifdef CONFIG_DEBUG_LOCK_ALLOC static struct lock_class_key rcu_lock_key;
@@ -66,6 +67,28 @@ EXPORT_SYMBOL_GPL(rcu_sched_lock_map);int rcu_scheduler_active__read_mostly ;EXPORT_SYMBOL_GPL (rcu_scheduler_active); +#ifdef CONFIG_DEBUG_LOCK_ALLOC + +/** +* rcu_read_lock_bh_held - might we be in RCU-bh read-side critical section? +* +* Check for bottom half being disabled, which covers both the +* CONFIG_PROVE_RCU and not cases. Note that if someone uses +* rcu_read_lock_bh(), but then later enables BH, lockdep (if enabled) +* will show the situation. +* +* Check debug_lockdep_rcu_enabled() to prevent false positives during boot. +*/ +int rcu_read_lock_bh_held (void ) +{ +if (!debug_lockdep_rcu_enabled ()) +return 1 ; +return in_softirq (); +} +EXPORT_SYMBOL_GPL (rcu_read_lock_bh_held); + +#endif /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ +/* * This function is invoked towards the end of the scheduler's initialization * process. Before this is called, the idle task might contain