* [PATCH 1/1] lockdep: pass curr_inner to print_lock_invalid_wait_context
@ 2022-06-16 13:40 Chen Jun
2022-06-17 13:22 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: Chen Jun @ 2022-06-16 13:40 UTC (permalink / raw)
To: linux-kernel, mingo, peterz, will; +Cc: xuqiang36
Same information (task_wait_context(curr)) is printed twice.
curr_inner in check_wait_context is what we need.
Signed-off-by: Chen Jun <chenjun102@huawei.com>
---
kernel/locking/lockdep.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 81e87280513e..2eb9802df7b9 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4676,10 +4676,8 @@ static inline short task_wait_context(struct task_struct *curr)
static int
print_lock_invalid_wait_context(struct task_struct *curr,
- struct held_lock *hlock)
+ struct held_lock *hlock, short curr_inner)
{
- short curr_inner;
-
if (!debug_locks_off())
return 0;
if (debug_locks_silent)
@@ -4695,9 +4693,7 @@ print_lock_invalid_wait_context(struct task_struct *curr,
print_lock(hlock);
pr_warn("other info that might help us debug this:\n");
-
- curr_inner = task_wait_context(curr);
- pr_warn("context-{%d:%d}\n", curr_inner, curr_inner);
+ pr_warn("context-{%d:%d}\n", curr_inner, task_wait_context(curr));
lockdep_print_held_locks(curr);
@@ -4763,7 +4759,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
}
if (next_outer > curr_inner)
- return print_lock_invalid_wait_context(curr, next);
+ return print_lock_invalid_wait_context(curr, next, curr_inner);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] lockdep: pass curr_inner to print_lock_invalid_wait_context
2022-06-16 13:40 [PATCH 1/1] lockdep: pass curr_inner to print_lock_invalid_wait_context Chen Jun
@ 2022-06-17 13:22 ` Peter Zijlstra
2022-06-20 8:46 ` chenjun (AM)
0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2022-06-17 13:22 UTC (permalink / raw)
To: Chen Jun; +Cc: linux-kernel, mingo, will, xuqiang36
On Thu, Jun 16, 2022 at 01:40:42PM +0000, Chen Jun wrote:
> Same information (task_wait_context(curr)) is printed twice.
Yes, because at that point the inner and outer context are the same.
> curr_inner in check_wait_context is what we need.
IIRC it simply prints the task_wait_context as a starting point, the
lockdep_print_held_locks() should include the contexts for each of
those, after which you can compute the resulting value.
IOW, the information is complete.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] lockdep: pass curr_inner to print_lock_invalid_wait_context
2022-06-17 13:22 ` Peter Zijlstra
@ 2022-06-20 8:46 ` chenjun (AM)
0 siblings, 0 replies; 3+ messages in thread
From: chenjun (AM) @ 2022-06-20 8:46 UTC (permalink / raw)
To: Peter Zijlstra; +Cc: linux-kernel, mingo, will, xuqiang (M)
在 2022/6/17 21:22, Peter Zijlstra 写道:
> On Thu, Jun 16, 2022 at 01:40:42PM +0000, Chen Jun wrote:
>> Same information (task_wait_context(curr)) is printed twice.
>
> Yes, because at that point the inner and outer context are the same.
>
>> curr_inner in check_wait_context is what we need.
>
> IIRC it simply prints the task_wait_context as a starting point, the
> lockdep_print_held_locks() should include the contexts for each of
> those, after which you can compute the resulting value.
>
> IOW, the information is complete.
>
>
>
Thanks for pointing this out.
--
Regards
Chen Jun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-20 8:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-16 13:40 [PATCH 1/1] lockdep: pass curr_inner to print_lock_invalid_wait_context Chen Jun
2022-06-17 13:22 ` Peter Zijlstra
2022-06-20 8:46 ` chenjun (AM)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).