Skip to content

Commit eb1f002

Browse files
author
Peter Zijlstra
committed
lockdep,trace: Expose tracepoints
The lockdep tracepoints are under the lockdep recursion counter, this has a bunch of nasty side effects: - TRACE_IRQFLAGS doesn't work across the entire tracepoint - RCU-lockdep doesn't see the tracepoints either, hiding numerous "suspicious RCU usage" warnings. Pull the trace_lock_*() tracepoints completely out from under the lockdep recursion handling and completely rely on the trace level recusion handling -- also, tracing *SHOULD* not be taking locks in any case. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Steven Rostedt (VMware) <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Tested-by: Marco Elver <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 044d0d6 commit eb1f002

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

kernel/locking/lockdep.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4977,6 +4977,8 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
49774977
{
49784978
unsigned long flags;
49794979

4980+
trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
4981+
49804982
if (unlikely(current->lockdep_recursion)) {
49814983
/* XXX allow trylock from NMI ?!? */
49824984
if (lockdep_nmi() && !trylock) {
@@ -5001,7 +5003,6 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
50015003
check_flags(flags);
50025004

50035005
current->lockdep_recursion++;
5004-
trace_lock_acquire(lock, subclass, trylock, read, check, nest_lock, ip);
50055006
__lock_acquire(lock, subclass, trylock, read, check,
50065007
irqs_disabled_flags(flags), nest_lock, ip, 0, 0);
50075008
lockdep_recursion_finish();
@@ -5013,13 +5014,15 @@ void lock_release(struct lockdep_map *lock, unsigned long ip)
50135014
{
50145015
unsigned long flags;
50155016

5017+
trace_lock_release(lock, ip);
5018+
50165019
if (unlikely(current->lockdep_recursion))
50175020
return;
50185021

50195022
raw_local_irq_save(flags);
50205023
check_flags(flags);
5024+
50215025
current->lockdep_recursion++;
5022-
trace_lock_release(lock, ip);
50235026
if (__lock_release(lock, ip))
50245027
check_chain_key(current);
50255028
lockdep_recursion_finish();
@@ -5205,8 +5208,6 @@ __lock_acquired(struct lockdep_map *lock, unsigned long ip)
52055208
hlock->holdtime_stamp = now;
52065209
}
52075210

5208-
trace_lock_acquired(lock, ip);
5209-
52105211
stats = get_lock_stats(hlock_class(hlock));
52115212
if (waittime) {
52125213
if (hlock->read)
@@ -5225,6 +5226,8 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
52255226
{
52265227
unsigned long flags;
52275228

5229+
trace_lock_acquired(lock, ip);
5230+
52285231
if (unlikely(!lock_stat || !debug_locks))
52295232
return;
52305233

@@ -5234,7 +5237,6 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
52345237
raw_local_irq_save(flags);
52355238
check_flags(flags);
52365239
current->lockdep_recursion++;
5237-
trace_lock_contended(lock, ip);
52385240
__lock_contended(lock, ip);
52395241
lockdep_recursion_finish();
52405242
raw_local_irq_restore(flags);
@@ -5245,6 +5247,8 @@ void lock_acquired(struct lockdep_map *lock, unsigned long ip)
52455247
{
52465248
unsigned long flags;
52475249

5250+
trace_lock_contended(lock, ip);
5251+
52485252
if (unlikely(!lock_stat || !debug_locks))
52495253
return;
52505254

0 commit comments

Comments
 (0)