Message ID | 20220712082606.3662616-2-qiang1.zhang@intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4dbfea53caf3e226e3273fc5947e9041e2ad34ab |
Headers | show |
Series | Optimize synchronize_rcu_tasks_generic() on early booting | expand |
On Tue, Jul 12, 2022 at 04:26:05PM +0800, Zqiang wrote: > For kernel build with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y, > when the synchronize_rcu_tasks_generic() called occurs during the > rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE, the warnings > will be trigger, however the warnings is not actually triggered because > the debug_lockdep_rcu_enabled() return false(the rcu_scheduler_active != > RCU_SCHEDULER_INACTIVE condition is false). > > This commit replace RCU_LOCKDEP_WARN() with WARN_ONCE() to trigger > warnings. > > Signed-off-by: Zqiang <qiang1.zhang@intel.com> Good catch, thank you! Queued with wordsmithing as follows. As always, please check to see if I wordsmithed something out of existence. Thanx, Paul ------------------------------------------------------------------------ commit 4dbfea53caf3e226e3273fc5947e9041e2ad34ab Author: Zqiang <qiang1.zhang@intel.com> Date: Tue Jul 12 16:26:05 2022 +0800 rcu-tasks: Convert RCU_LOCKDEP_WARN() to WARN_ONCE() Kernels built with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y attempt to emit a warning when the synchronize_rcu_tasks_generic() function is called during early boot while the rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE. However the warnings is not actually be printed because the debug_lockdep_rcu_enabled() returns false, exactly because the rcu_scheduler_active variable is still equal to RCU_SCHEDULER_INACTIVE. This commit therefore replaces RCU_LOCKDEP_WARN() with WARN_ONCE() to force these warnings to actually be printed. Signed-off-by: Zqiang <qiang1.zhang@intel.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 83c7e6620d403..469bf2a3b505e 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -560,7 +560,7 @@ static int __noreturn rcu_tasks_kthread(void *arg) static void synchronize_rcu_tasks_generic(struct rcu_tasks *rtp) { /* Complain if the scheduler has not started. */ - RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, + WARN_ONCE(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, "synchronize_rcu_tasks called too soon"); // If the grace-period kthread is running, use it.
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index 83c7e6620d40..469bf2a3b505 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -560,7 +560,7 @@ static int __noreturn rcu_tasks_kthread(void *arg) static void synchronize_rcu_tasks_generic(struct rcu_tasks *rtp) { /* Complain if the scheduler has not started. */ - RCU_LOCKDEP_WARN(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, + WARN_ONCE(rcu_scheduler_active == RCU_SCHEDULER_INACTIVE, "synchronize_rcu_tasks called too soon"); // If the grace-period kthread is running, use it.
For kernel build with CONFIG_PROVE_RCU=y and CONFIG_DEBUG_LOCK_ALLOC=y, when the synchronize_rcu_tasks_generic() called occurs during the rcu_scheduler_active variable is RCU_SCHEDULER_INACTIVE, the warnings will be trigger, however the warnings is not actually triggered because the debug_lockdep_rcu_enabled() return false(the rcu_scheduler_active != RCU_SCHEDULER_INACTIVE condition is false). This commit replace RCU_LOCKDEP_WARN() with WARN_ONCE() to trigger warnings. Signed-off-by: Zqiang <qiang1.zhang@intel.com> --- kernel/rcu/tasks.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)