From: Wenjun Huo <huowenjun.dev@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: Wenjun Huo <huowenjun.dev@gmail.com>
Subject: trace-cmd: question about explicit host endianness setting
Date: Tue, 23 Dec 2025 22:42:21 +0800 [thread overview]
Message-ID: <20251223144221.1624-1-huowenjun.dev@gmail.com> (raw)
Dear Tracers,
While reading the trace-cmd code, I noticed a detail in
tracecmd_alloc_fd() regarding endianness handling and wanted to
double-check my understanding.
In tracecmd_alloc_fd(), after tep_alloc() and plugin loading,
trace-cmd explicitly sets both file and local endianness:
tep_set_file_bigendian(handle->pevent, buf[0]);
tep_set_local_bigendian(handle->pevent, tracecmd_host_bigendian());
I understand that setting the file endianness here is required,
since it is read from the trace file header.
For the local/host endianness, tep_alloc() already initializes
host_bigendian via tep_is_bigendian(), and in the common case
tracecmd_host_bigendian() resolves to the same value. So in practice
this explicit call usually does not change the value.
My understanding is that this is intentional, and that the call to
tep_set_local_bigendian() serves as an explicit binding step, making
it clear that trace-cmd confirms the local execution endianness
after parsing the trace header and loading plugins, rather than
relying on tep_alloc() defaults.
Could you please confirm if this interpretation is correct, and
whether this explicit setting is mainly for clarity / defensive API
usage rather than functional necessity?
If maintainers think there is a better way to clarify or improve
this behavior (for example via comments, documentation, or code
adjustments), I would be very happy to help by preparing and sending
a patch based on your guidance.
Thanks for your time.
Best regards,
Wenjun Huo
next reply other threads:[~2025-12-23 14:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 14:42 Wenjun Huo [this message]
2025-12-23 20:49 ` trace-cmd: question about explicit host endianness setting Steven Rostedt
2025-12-25 4:52 ` Wenjun Huo
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=20251223144221.1624-1-huowenjun.dev@gmail.com \
--to=huowenjun.dev@gmail.com \
--cc=linux-trace-devel@vger.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 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.