Skip to contentSkip to conversation

s390/spinlock: Add contention tracepoints to lock slowpath

PATCH Applied Ciunas Bennett 4 participants 4 messages Jul 23 s390

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/spinlock: Add contention tracepoints to lock slowpath

Instrument arch_spin_lock_wait() with trace_contention_begin() and trace_contention_end().

These tracepoints are used by lock contention analysis tools such as perf lock contention to identify contended locks and measure wait times. Both the generic implementation and powerpc emit the same events from their spinlock slow path.

Place the tracepoints in arch_spin_lock_wait(), which is only entered when lock acquisition falls back to the contention path.

---
 arch/s390/lib/spinlock.c | 3 +++
 1 file changed, 3 insertions(+)
arch/s390/lib/spinlock.c +3 -0
index 10db1e56a811..dbabca35c008 100644
@@ -18,6 +18,7 @@
 #include <asm/alternative.h>
 #include <asm/machine.h>
 #include <asm/asm.h>
+#include <trace/events/lock.h>
 
 int spin_retry = -1;
 
@@ -281,10 +282,12 @@ static inline void arch_spin_lock_classic(arch_spinlock_t *lp)
 
 void arch_spin_lock_wait(arch_spinlock_t *lp)
 {
+	trace_contention_begin(lp, LCB_F_SPIN);
 	if (test_cpu_flag(CIF_DEDICATED_CPU))
 		arch_spin_lock_queued(lp);
 	else
 		arch_spin_lock_classic(lp);
+	trace_contention_end(lp, 0);
 }
 EXPORT_SYMBOL(arch_spin_lock_wait);
 

base-commit: 1590cf0329716306e948a8fc29f1d3ee87d3989f

Signature · 1 line
2.54.0
#1 lore raw
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 8 lines

Instrument arch_spin_lock_wait() with trace_contention_begin() and trace_contention_end().

These tracepoints are used by lock contention analysis tools such as perf lock contention to identify contended locks and measure wait times. Both the generic implementation and powerpc emit the same events from their spinlock slow path.

Quoted 4 lines

Place the tracepoints in arch_spin_lock_wait(), which is only entered when lock acquisition falls back to the contention path.

Sashiko has reviewed this patch and found no issues. It looks great!

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Ciunas Bennett
Quoted 8 lines · Ciunas Bennett

Instrument arch_spin_lock_wait() with trace_contention_begin() and trace_contention_end().

These tracepoints are used by lock contention analysis tools such as perf lock contention to identify contended locks and measure wait times. Both the generic implementation and powerpc emit the same events from their spinlock slow path.

Quoted 7 lines

Place the tracepoints in arch_spin_lock_wait(), which is only entered when lock acquisition falls back to the contention path.

---
 arch/s390/lib/spinlock.c | 3 +++
 1 file changed, 3 insertions(+)
maintainer Applied
#3 lore raw
In reply to Ciunas Bennett
Quoted 8 lines · Ciunas Bennett

Instrument arch_spin_lock_wait() with trace_contention_begin() and trace_contention_end().

These tracepoints are used by lock contention analysis tools such as perf lock contention to identify contended locks and measure wait times. Both the generic implementation and powerpc emit the same events from their spinlock slow path.

Quoted 7 lines

Place the tracepoints in arch_spin_lock_wait(), which is only entered when lock acquisition falls back to the contention path.

---
 arch/s390/lib/spinlock.c | 3 +++
 1 file changed, 3 insertions(+)

Applied, thank you!