From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
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: Re: [PATCH v2 3/3] tracing: Show TID and flags for PI futex system call trace event
Date: Thu, 12 Mar 2026 17:15:05 +0900 [thread overview]
Message-ID: <20260312171505.bd5c45cb67d42c7ab3cfe1f9@kernel.org> (raw)
In-Reply-To: <20260310201036.879130564@kernel.org>
On Tue, 10 Mar 2026 16:09:57 -0400
Steven Rostedt <rostedt@kernel.org> wrote:
> 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.
>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
> ---
> Changes since v1: https://lore.kernel.org/all/20260303174442.548b6524@gandalf.local.home/
>
> - Updated to have the print processing in kernel/futex/syscall.c
>
> 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 a46706d6bc6c..24d912d9b20d 100644
> --- a/kernel/futex/syscalls.c
> +++ b/kernel/futex/syscalls.c
> @@ -211,6 +211,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))
> @@ -225,11 +228,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
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2026-03-12 8:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 20:09 [PATCH v2 0/3] tracing: Read user data from futex system call trace event Steven Rostedt
2026-03-10 20:09 ` [PATCH v2 1/3] tracing: Have futex syscall trace event show specific user data Steven Rostedt
2026-03-11 7:41 ` kernel test robot
2026-03-11 9:03 ` Masami Hiramatsu
2026-03-11 14:16 ` Steven Rostedt
2026-03-11 11:23 ` kernel test robot
2026-03-10 20:09 ` [PATCH v2 2/3] tracing: Update futex syscall trace event to show more commands Steven Rostedt
2026-03-12 5:34 ` Masami Hiramatsu
2026-03-10 20:09 ` [PATCH v2 3/3] tracing: Show TID and flags for PI futex system call trace event Steven Rostedt
2026-03-12 8:15 ` Masami Hiramatsu [this message]
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=20260312171505.bd5c45cb67d42c7ab3cfe1f9@kernel.org \
--to=mhiramat@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=peterz@infradead.org \
--cc=rostedt@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox