From: Steven Rostedt <rostedt@goodmis.org>
To: Sven Schnelle <svens@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing/synthetic: use union instead of casts
Date: Tue, 8 Aug 2023 13:27:26 -0400 [thread overview]
Message-ID: <20230808132726.08cabfbc@gandalf.local.home> (raw)
In-Reply-To: <20230808142148.2652883-1-svens@linux.ibm.com>
On Tue, 8 Aug 2023 16:21:48 +0200
Sven Schnelle <svens@linux.ibm.com> wrote:
> +struct trace_dynamic {
> + union {
> + u8 as_u8;
> + u16 as_u16;
> + u32 as_u32;
> + u64 as_u64;
> + struct {
> +#ifdef CONFIG_CPU_BIG_ENDIAN
> + u16 offset;
> + u16 len;
> +#else
> + u16 len;
> + u16 offset;
> +#endif
> + };
> + };
> +};
> +
The "dynamic" I was using wasn't about the fields were dynamic (union), but
because the field the offset/len combo represents is of dynamic size. It's
used all over the trace_events code.
I would have in include/linux/trace_events.h (right above struct trace_entry):
/* Used to find the offset and length of dynamic fields in trace events */
struct trace_dynamic_info {
#ifdef CONFIG_CPU_BIG_ENDIAN
u16 offset;
u16 len;
#else
u16 len;
u16 offset;
#endif
};
And then it kernel/trace/trace.h:
union trace_synthetic_field {
u8 as_u8;
u16 as_u16;
u32 as_u32;
u64 as_u64;
struct trace_dynamic_info as_dynamic;
};
I could work on the part of the trace_dynamic_info if you want.
-- Steve
next prev parent reply other threads:[~2023-08-08 18:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-08 14:21 Sven Schnelle
2023-08-08 17:27 ` Steven Rostedt [this message]
2023-08-08 17:33 ` Sven Schnelle
2023-08-08 20:05 ` Steven Rostedt
2023-08-09 7:16 ` Sven Schnelle
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=20230808132726.08cabfbc@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=svens@linux.ibm.com \
/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®