Skip to content

Commit

Permalink
locking/lockdep: Correct calling tracepoints
Browse files Browse the repository at this point in the history
The commit eb1f002 ("lockdep,trace: Expose tracepoints") reverses
tracepoints for lock_contended() and lock_acquired(), thus the ftrace
log shows the wrong locking sequence that "acquired" event is prior to
"contended" event:

  <idle>-0       [001] d.s3 20803.501685: lock_acquire: 0000000008b91ab4 &sg_policy->update_lock
  <idle>-0       [001] d.s3 20803.501686: lock_acquired: 0000000008b91ab4 &sg_policy->update_lock
  <idle>-0       [001] d.s3 20803.501689: lock_contended: 0000000008b91ab4 &sg_policy->update_lock
  <idle>-0       [001] d.s3 20803.501690: lock_release: 0000000008b91ab4 &sg_policy->update_lock

This patch fixes calling tracepoints for lock_contended() and
lock_acquired().

Fixes: eb1f002 ("lockdep,trace: Expose tracepoints")
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210512120937.90211-1-leo.yan@linaro.org
  • Loading branch information
Leo Yan authored and Peter Zijlstra committed May 18, 2021
1 parent d07f6ca commit 89e70d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/locking/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -5736,7 +5736,7 @@ void lock_contended(struct lockdep_map *lock, unsigned long ip)
{
unsigned long flags;

trace_lock_acquired(lock, ip);
trace_lock_contended(lock, ip);

if (unlikely(!lock_stat || !lockdep_enabled()))
return;
Expand All @@ -5754,7 +5754,7 @@ void lock_acquired(struct lockdep_map *lock, unsigned long ip)
{
unsigned long flags;

trace_lock_contended(lock, ip);
trace_lock_acquired(lock, ip);

if (unlikely(!lock_stat || !lockdep_enabled()))
return;
Expand Down

0 comments on commit 89e70d5

Please sign in to comment.