[PATCH] locking/lockdep: use pr_warn_once for reporting that lockdep is turned off

Tetsuo Handa posted 1 patch 3 years, 9 months ago
kernel/locking/lockdep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] locking/lockdep: use pr_warn_once for reporting that lockdep is turned off
Posted by Tetsuo Handa 3 years, 9 months ago
debug_show_all_locks() can be called for multiple times if
hung_task_call_panic = 0. No need to repeat this message.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 kernel/locking/lockdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 64a13eb56078..27be3c83c753 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -6490,7 +6490,7 @@ void debug_show_all_locks(void)
 	struct task_struct *g, *p;
 
 	if (unlikely(!debug_locks)) {
-		pr_warn("INFO: lockdep is turned off.\n");
+		pr_warn_once("INFO: lockdep is turned off.\n");
 		return;
 	}
 	pr_warn("\nShowing all locks held in the system:\n");
@@ -6518,7 +6518,7 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks);
 void debug_show_held_locks(struct task_struct *task)
 {
 	if (unlikely(!debug_locks)) {
-		printk("INFO: lockdep is turned off.\n");
+		pr_warn_once("INFO: lockdep is turned off.\n");
 		return;
 	}
 	lockdep_print_held_locks(task);
-- 
2.18.4
Re: [PATCH] locking/lockdep: use pr_warn_once for reporting that lockdep is turned off
Posted by Peter Zijlstra 3 years, 9 months ago
On Wed, Jul 20, 2022 at 10:01:36PM +0900, Tetsuo Handa wrote:
> debug_show_all_locks() can be called for multiple times if
> hung_task_call_panic = 0. No need to repeat this message.

That one extra line is really a problem?
Re: [PATCH] locking/lockdep: use pr_warn_once for reporting that lockdep is turned off
Posted by Tetsuo Handa 3 years, 9 months ago
On 2022/07/20 23:59, Peter Zijlstra wrote:
> On Wed, Jul 20, 2022 at 10:01:36PM +0900, Tetsuo Handa wrote:
>> debug_show_all_locks() can be called for multiple times if
>> hung_task_call_panic = 0. No need to repeat this message.
> 
> That one extra line is really a problem?

When lockdep is turned off during boot or some testing, khungtaskd repeats
this message, and I feel this repeated message useless.
Re: [PATCH] locking/lockdep: use pr_warn_once for reporting that lockdep is turned off
Posted by Peter Zijlstra 3 years, 9 months ago
On Thu, Jul 21, 2022 at 12:13:31AM +0900, Tetsuo Handa wrote:
> On 2022/07/20 23:59, Peter Zijlstra wrote:
> > On Wed, Jul 20, 2022 at 10:01:36PM +0900, Tetsuo Handa wrote:
> >> debug_show_all_locks() can be called for multiple times if
> >> hung_task_call_panic = 0. No need to repeat this message.
> > 
> > That one extra line is really a problem?
> 
> When lockdep is turned off during boot or some testing, khungtaskd repeats
> this message, and I feel this repeated message useless.

I feel you should then fix the issue that lockdep is complaining about
instead of making the message go away.