Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath
@ 2026-07-23  8:42 Ciunas Bennett
  2026-07-23  8:51 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ciunas Bennett @ 2026-07-23  8:42 UTC (permalink / raw)
  To: linux-s390
  Cc: hca, gor, agordeev, borntraeger, huschle, svens, 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.

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

Signed-off-by: Ciunas Bennett <ciunas@linux.ibm.com>
---
 arch/s390/lib/spinlock.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 10db1e56a811..dbabca35c008 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -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
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath
  2026-07-23  8:42 [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath Ciunas Bennett
@ 2026-07-23  8:51 ` sashiko-bot
  2026-07-23 10:01 ` Heiko Carstens
  2026-07-23 15:37 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-07-23  8:51 UTC (permalink / raw)
  To: Ciunas Bennett
  Cc: linux-s390, Heiko Carstens, Alexander Gordeev, Vasily Gorbik

> 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.
> 
> Signed-off-by: Ciunas Bennett <ciunas@linux.ibm.com>

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

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723084229.923353-1-ciunas@linux.ibm.com?part=1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath
  2026-07-23  8:42 [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath Ciunas Bennett
  2026-07-23  8:51 ` sashiko-bot
@ 2026-07-23 10:01 ` Heiko Carstens
  2026-07-23 15:37 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2026-07-23 10:01 UTC (permalink / raw)
  To: Ciunas Bennett; +Cc: linux-s390, gor, agordeev, borntraeger, huschle, svens

On Thu, Jul 23, 2026 at 10:42:29AM +0200, Ciunas Bennett wrote:
> 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.
> 
> Signed-off-by: Ciunas Bennett <ciunas@linux.ibm.com>
> ---
>  arch/s390/lib/spinlock.c | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Heiko Carstens <hca@linux.ibm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath
  2026-07-23  8:42 [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath Ciunas Bennett
  2026-07-23  8:51 ` sashiko-bot
  2026-07-23 10:01 ` Heiko Carstens
@ 2026-07-23 15:37 ` Vasily Gorbik
  2 siblings, 0 replies; 4+ messages in thread
From: Vasily Gorbik @ 2026-07-23 15:37 UTC (permalink / raw)
  To: Ciunas Bennett; +Cc: linux-s390, hca, agordeev, borntraeger, huschle, svens

On Thu, Jul 23, 2026 at 10:42:29AM +0200, Ciunas Bennett wrote:
> 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.
> 
> Signed-off-by: Ciunas Bennett <ciunas@linux.ibm.com>
> ---
>  arch/s390/lib/spinlock.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thank you!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-23 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  8:42 [PATCH] s390/spinlock: Add contention tracepoints to lock slowpath Ciunas Bennett
2026-07-23  8:51 ` sashiko-bot
2026-07-23 10:01 ` Heiko Carstens
2026-07-23 15:37 ` Vasily Gorbik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox