From: Douglas Raillard <douglas.raillard@arm.com>
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>,
Peter Zijlstra <peterz@infradead.org>,
Namhyung Kim <namhyung@kernel.org>,
Takaya Saeki <takayas@google.com>,
Tom Zanussi <zanussi@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ian Rogers <irogers@google.com>,
aahringo@redhat.com
Subject: Re: [PATCH 2/7] tracing: Have syscall trace events show "0x" for values greater than 10
Date: Wed, 6 Aug 2025 17:42:38 +0100 [thread overview]
Message-ID: <8ec3ecea-a830-4de2-8191-e3a78b4427f0@arm.com> (raw)
In-Reply-To: <20250806083944.036de894@batman.local.home>
On 06-08-2025 13:39, Steven Rostedt wrote:
> On Wed, 6 Aug 2025 11:24:33 +0100
> Douglas Raillard <douglas.raillard@arm.com> wrote:
>
>> On 05-08-2025 20:26, Steven Rostedt wrote:
>>> From: Steven Rostedt <rostedt@goodmis.org>
>>>
>>> Currently the syscall trace events show each value as hexadecimal, but
>>> without adding "0x" it can be confusing:
>>>
>>> sys_write(fd: 4, buf: 0x55c4a1fa9270, count: 44)
>>>
>>> Looks like the above write wrote 44 bytes, when in reality it wrote 68
>>> bytes.
>>>
>>> Add a "0x" for all values greater or equal to 10 to remove the ambiguity.
>>> For values less than 10, leave off the "0x" as that just adds noise to the
>>> output.
>>
>> I'm on the fence for the value-dependent format. This looks like
>> it could easily make life harder for quick&dirty scripts, but then both
>> awk's strtonum() and Python's int(x, base=16) seem to handle
>> the presence/absence of the 0x prefix so maybe it's a non-issue.
>
> Yes, but the trace file is more for humans than scripts, and the 0x1 is
> just noise.
>
>>
>> OTH, a hand-crafted regex designed after a small set of input may start
>> to randomly fail if one field unexpectedly goes beyond 10 ...
>
> If you are doing hand crafted scripts, I'd suggest to use tracing
> filters or other tooling that can handle this easily ;-)
Well, we both know I don't do this sort of things (or do I ? :) ) but for
the first 5+ years of its existence, LISA was actually parsing the text
output of trace-cmd, and I'd be surprised if it was the only place this was done.
AFAIK to this day, there is no tool providing a simple script/SQL interface
to a trace.dat file beyond basic filtering like trace-cmd report. I've had this
PR [1] opened for a while in LISA that does exactly that but got distracted with
other things:
# Show all the CPUs that emitted a cpu_frequency event
lisa-trace sql trace.dat --query 'SELECT DISTINCT cpu_id FROM cpu_frequency'
shape: (8, 1)
┌────────┐
│ cpu_id │
│ --- │
│ u32 │
╞════════╡
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 7 │
│ 4 │
│ 5 │
│ 6 │
└────────┘
[1] https://gitlab.arm.com/tooling/lisa/-/merge_requests/2444
>
>>
>> Just using explicit hex may be the best here, as the actual proper fix
>> (type-level display hints) is harder. It could probably be implemented
>> using btf_decl_tag() and __builtin_btf_type_id() to retrieve the BTF info.
>
> That would add a dependency on BTF, which I would like to avoid.
>
> Thanks!
>
> -- Steve
>
--
Douglas
next prev parent reply other threads:[~2025-08-06 16:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 19:26 [PATCH 0/7] tracing: Show contents of syscall trace event user space fields Steven Rostedt
2025-08-05 19:26 ` [PATCH 1/7] tracing: Replace syscall RCU pointer assignment with READ/WRITE_ONCE() Steven Rostedt
2025-08-06 18:39 ` Paul E. McKenney
2025-09-11 23:20 ` Steven Rostedt
2025-08-06 22:05 ` kernel test robot
2025-08-05 19:26 ` [PATCH 2/7] tracing: Have syscall trace events show "0x" for values greater than 10 Steven Rostedt
2025-08-06 10:24 ` Douglas Raillard
2025-08-06 12:39 ` Steven Rostedt
2025-08-06 16:42 ` Douglas Raillard [this message]
2025-08-12 19:22 ` Steven Rostedt
2025-08-05 19:26 ` [PATCH 3/7] tracing: Have syscall trace events read user space string Steven Rostedt
2025-08-06 14:39 ` kernel test robot
2025-08-11 5:19 ` kernel test robot
2025-08-05 19:26 ` [PATCH 4/7] tracing: Have system call events record user array data Steven Rostedt
2025-08-05 19:26 ` [PATCH 5/7] tracing: Display some syscall arrays as strings Steven Rostedt
2025-08-06 15:12 ` kernel test robot
2025-08-05 19:26 ` [PATCH 6/7] tracing: Allow syscall trace events to read more than one user parameter Steven Rostedt
2025-08-06 23:52 ` kernel test robot
2025-08-05 19:26 ` [PATCH 7/7] tracing: Add syscall_user_buf_size to limit amount written Steven Rostedt
2025-08-06 10:50 ` Douglas Raillard
2025-08-06 12:43 ` Steven Rostedt
2025-08-06 16:21 ` Douglas Raillard
2025-08-06 14:50 ` kernel test robot
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=8ec3ecea-a830-4de2-8191-e3a78b4427f0@arm.com \
--to=douglas.raillard@arm.com \
--cc=aahringo@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=irogers@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=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@kernel.org \
--cc=takayas@google.com \
--cc=tglx@linutronix.de \
--cc=zanussi@kernel.org \
/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
all inboxes | Powered by JetHome®