From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Brian Geffon <bgeffon@google.com>,
John Stultz <jstultz@google.com>, Ian Rogers <irogers@google.com>,
Suleiman Souhlal <suleiman@google.com>
Subject: [PATCH v3 3/3] tracing: Show TID and flags for PI futex system call trace event
Date: Tue, 31 Mar 2026 14:13:52 -0400 [thread overview]
Message-ID: <20260331181433.309946057@kernel.org> (raw)
In-Reply-To: 20260331181349.062575155@kernel.org
From: Steven Rostedt <rostedt@goodmis.org>
For the futex system call trace event for FUTEX_LOCK_PI and
FUTEX_UNLOCK_PI commands, show the TID from the value (which is usually in
hex) as well as translate the flags (DIED and WAITERS).
pi_mutex_hammer-1098 [000] ..... 121.876928: sys_futex(uaddr: 0x560f40cc8180 (0x450) tid: 1104, FUTEX_LOCK_PI|FUTEX_PRIVATE_FLAG, val: 0, timespec: 0x7f2f9d4b1e50 (0.000100000))
pi_mutex_hammer-1128 [000] ..... 121.877120: sys_futex(uaddr: 0x560f40cc8180 (0x8000042a) tid: 1066 (WAITERS), FUTEX_LOCK_PI|FUTEX_PRIVATE_FLAG, val: 0, timespec: 0x7f2f8e493e50 (0.000100000))
pi_mutex_hammer-1106 [000] ..... 121.877242: sys_futex(uaddr: 0x560f40cc8180 (0x80000452) tid: 1106 (WAITERS), FUTEX_UNLOCK_PI|FUTEX_PRIVATE_FLAG, val: 0)
This makes it easier to see the hand off of a mutex and who the owner was.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
kernel/futex/syscalls.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/kernel/futex/syscalls.c b/kernel/futex/syscalls.c
index 265ec0a236d0..8144781a9ff0 100644
--- a/kernel/futex/syscalls.c
+++ b/kernel/futex/syscalls.c
@@ -213,6 +213,9 @@ void futex_print_syscall(struct seq_buf *s, int nr_args, unsigned long *args,
unsigned int op, cmd;
bool done = false;
+ op = args[1];
+ cmd = op & FUTEX_CMD_MASK;
+
for (int i = 0; !done && i < nr_args; i++) {
if (seq_buf_has_overflowed(s))
@@ -227,11 +230,30 @@ void futex_print_syscall(struct seq_buf *s, int nr_args, unsigned long *args,
seq_buf_printf(s, " (%u)", val);
else
seq_buf_printf(s, " (0x%x)", val);
+
+ switch(cmd) {
+ case FUTEX_LOCK_PI:
+ case FUTEX_UNLOCK_PI:
+ seq_buf_printf(s, " tid: %d",
+ val & FUTEX_TID_MASK);
+
+ if (!(val & (FUTEX_OWNER_DIED|FUTEX_WAITERS)))
+ break;
+
+ seq_buf_puts(s, " (");
+ if (val & FUTEX_WAITERS)
+ seq_buf_puts(s, "WAITERS");
+ if (val & FUTEX_OWNER_DIED) {
+ if (op & FUTEX_WAITERS)
+ seq_buf_putc(s, '|');
+ seq_buf_puts(s, "DIED");
+ }
+ seq_buf_putc(s, ')');
+ break;
+ }
}
continue;
case 1:
- op = args[i];
- cmd = op & FUTEX_CMD_MASK;
if (cmd <= FUTEX_LOCK_PI2)
seq_buf_printf(s, ", %s", __futex_cmds[cmd]);
else
--
2.51.0
next prev parent reply other threads:[~2026-03-31 18:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 18:13 [PATCH v3 0/3] tracing: Read user data from futex system call trace event Steven Rostedt
2026-03-31 18:13 ` [PATCH v3 1/3] tracing: Have futex syscall trace event show specific user data Steven Rostedt
2026-04-01 18:07 ` Ian Rogers
2026-04-01 18:17 ` Steven Rostedt
2026-03-31 18:13 ` [PATCH v3 2/3] tracing: Update futex syscall trace event to show more commands Steven Rostedt
2026-03-31 18:13 ` Steven Rostedt [this message]
2026-04-01 17:15 ` [PATCH v3 0/3] tracing: Read user data from futex system call trace event Steven Rostedt
2026-04-01 19:31 ` Thomas Gleixner
2026-04-01 20:13 ` Peter Zijlstra
2026-04-01 20:19 ` Steven Rostedt
2026-04-01 20:25 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260331181433.309946057@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bgeffon@google.com \
--cc=irogers@google.com \
--cc=jstultz@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=suleiman@google.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.