public inbox for linux-trace-devel@vger.kernel.org
 help / color / mirror / Atom feed
* trace-cmd: question about explicit host endianness setting
@ 2025-12-23 14:42 Wenjun Huo
  2025-12-23 20:49 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Wenjun Huo @ 2025-12-23 14:42 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Wenjun Huo

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


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

end of thread, other threads:[~2025-12-25  4:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 14:42 trace-cmd: question about explicit host endianness setting Wenjun Huo
2025-12-23 20:49 ` Steven Rostedt
2025-12-25  4:52   ` Wenjun Huo

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