Commit 23870f1
locking/lockdep: Fix "USED" <- "IN-NMI" inversions
During the LPC RCU BoF Paul asked how come the "USED" <- "IN-NMI"
detector doesn't trip over rcu_read_lock()'s lockdep annotation.
Looking into this I found a very embarrasing typo in
verify_lock_unused():
- if (!(class->usage_mask & LOCK_USED))
+ if (!(class->usage_mask & LOCKF_USED))
fixing that will indeed cause rcu_read_lock() to insta-splat :/
The above typo means that instead of testing for: 0x100 (1 <<
LOCK_USED), we test for 8 (LOCK_USED), which corresponds to (1 <<
LOCK_ENABLED_HARDIRQ).
So instead of testing for _any_ used lock, it will only match any lock
used with interrupts enabled.
The rcu_read_lock() annotation uses .check=0, which means it will not
set any of the interrupt bits and will thus never match.
In order to properly fix the situation and allow rcu_read_lock() to
correctly work, split LOCK_USED into LOCK_USED and LOCK_USED_READ and by
having .read users set USED_READ and test USED, pure read-recursive
locks are permitted.
Fixes: f6f48e1 ("lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20200902160323.GK1362448@hirez.programming.kicks-ass.net1 parent fc3abb5 commit 23870f1
2 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3969 | 3969 | | |
3970 | 3970 | | |
3971 | 3971 | | |
3972 | | - | |
| 3972 | + | |
3973 | 3973 | | |
3974 | 3974 | | |
3975 | 3975 | | |
3976 | 3976 | | |
3977 | 3977 | | |
3978 | 3978 | | |
| 3979 | + | |
| 3980 | + | |
| 3981 | + | |
| 3982 | + | |
| 3983 | + | |
3979 | 3984 | | |
3980 | 3985 | | |
3981 | 3986 | | |
| |||
3988 | 3993 | | |
3989 | 3994 | | |
3990 | 3995 | | |
3991 | | - | |
3992 | | - | |
3993 | | - | |
3994 | | - | |
| 3996 | + | |
| 3997 | + | |
3995 | 3998 | | |
| 3999 | + | |
3996 | 4000 | | |
3997 | 4001 | | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
| 4005 | + | |
| 4006 | + | |
| 4007 | + | |
| 4008 | + | |
| 4009 | + | |
| 4010 | + | |
| 4011 | + | |
3998 | 4012 | | |
3999 | 4013 | | |
4000 | 4014 | | |
| |||
4008 | 4022 | | |
4009 | 4023 | | |
4010 | 4024 | | |
| 4025 | + | |
4011 | 4026 | | |
4012 | 4027 | | |
4013 | 4028 | | |
| |||
4942 | 4957 | | |
4943 | 4958 | | |
4944 | 4959 | | |
| 4960 | + | |
4945 | 4961 | | |
4946 | 4962 | | |
4947 | 4963 | | |
4948 | 4964 | | |
4949 | 4965 | | |
4950 | | - | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
| 4973 | + | |
4951 | 4974 | | |
4952 | 4975 | | |
4953 | 4976 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
0 commit comments