From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: [PATCH v7] tracing: Rename __dynamic_array() to __dynamic_field() for ftrace events
Date: Mon, 30 Nov 2026 14:49:41 -0500 [thread overview]
Message-ID: <20261130144941.27cdb72d@gandalf.local.home> (raw)
From: Steven Rostedt <rostedt@goodmis.org>
The ftrace events (like function, trace_print, etc) are created somewhat
manually and not via the TRACE_EVENT() or tracepoint magic macros. It has
its own macros.
The dynamic fields used __dynamic_array() to be created, but the output is
different than the __dynamic_array() used by TRACE_EVENT().
The TRACE_EVENT() __dynamic_array() creates the field like:
field:__data_loc u8[] v_data; offset:120; size:4; signed:0;
Whereas the ftrace event is created as:
field:char buf[]; offset:12; size:0; signed:0;
The difference is that the ftrace field is defined as the rest of the size
of the event saved in the ring buffer. TRACE_EVENT() doesn't have such a
dynamic field, and its version saves a word that holds the offset into the
event that the field is stored, as well as the size.
For consistency rename the ftrace event macro to __dynamic_field(). This
way the ftrace event can also include a __dynamic_array() later that works
the same as the TRACE_EVENT() dynamic array.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
Changes since v6: https://patch.msgid.link/20250828180356.716157474@kernel.org
- Make a separate patch from the user stack trace series. This patch stands
on its own.
- Update a missed conversion due to the fgraph_retaddr_ent_entry event
being added.
kernel/trace/trace.h | 4 ++--
kernel/trace/trace_entries.h | 12 ++++++------
kernel/trace/trace_export.c | 12 ++++++------
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 2efb580d7a15..ff08474d6e79 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -97,8 +97,8 @@ enum trace_type {
#undef __array_desc
#define __array_desc(type, container, item, size)
-#undef __dynamic_array
-#define __dynamic_array(type, item) type item[];
+#undef __dynamic_field
+#define __dynamic_field(type, item) type item[];
#undef __rel_dynamic_array
#define __rel_dynamic_array(type, item) type item[];
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index 54417468fdeb..4981f21267a7 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -63,7 +63,7 @@ FTRACE_ENTRY_REG(function, ftrace_entry,
F_STRUCT(
__field_fn( unsigned long, ip )
__field_fn( unsigned long, parent_ip )
- __dynamic_array( unsigned long, args )
+ __dynamic_field( unsigned long, args )
),
F_printk(" %ps <-- %ps",
@@ -81,7 +81,7 @@ FTRACE_ENTRY(funcgraph_entry, ftrace_graph_ent_entry,
__field_struct( struct ftrace_graph_ent, graph_ent )
__field_desc_packed(unsigned long, graph_ent, func )
__field_desc_packed(unsigned long, graph_ent, depth )
- __dynamic_array(unsigned long, args )
+ __dynamic_field(unsigned long, args )
),
F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
@@ -99,7 +99,7 @@ FTRACE_ENTRY_PACKED(fgraph_retaddr_entry, fgraph_retaddr_ent_entry,
__field_desc_packed( unsigned long, graph_rent.ent, func )
__field_desc_packed( unsigned long, graph_rent.ent, depth )
__field_desc_packed( unsigned long, graph_rent, retaddr )
- __dynamic_array(unsigned long, args )
+ __dynamic_field(unsigned long, args )
),
F_printk("--> %ps (%lu) <- %ps", (void *)__entry->func, __entry->depth,
@@ -260,7 +260,7 @@ FTRACE_ENTRY(bprint, bprint_entry,
F_STRUCT(
__field( unsigned long, ip )
__field( const char *, fmt )
- __dynamic_array( u32, buf )
+ __dynamic_field( u32, buf )
),
F_printk("%ps: %s",
@@ -273,7 +273,7 @@ FTRACE_ENTRY_REG(print, print_entry,
F_STRUCT(
__field( unsigned long, ip )
- __dynamic_array( char, buf )
+ __dynamic_field( char, buf )
),
F_printk("%ps: %s",
@@ -288,7 +288,7 @@ FTRACE_ENTRY(raw_data, raw_data_entry,
F_STRUCT(
__field( unsigned int, id )
- __dynamic_array( char, buf )
+ __dynamic_field( char, buf )
),
F_printk("id:%04x %08x",
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index 32a42ef31855..f0060bea2dad 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -60,8 +60,8 @@ static int ftrace_event_register(struct trace_event_call *call,
#undef __array_desc
#define __array_desc(type, container, item, size) type item[size];
-#undef __dynamic_array
-#define __dynamic_array(type, item) type item[];
+#undef __dynamic_field
+#define __dynamic_field(type, item) type item[];
#undef F_STRUCT
#define F_STRUCT(args...) args
@@ -129,8 +129,8 @@ static void __always_unused ____ftrace_check_##name(void) \
#undef __array_desc
#define __array_desc(_type, _container, _item, _len) __array(_type, _item, _len)
-#undef __dynamic_array
-#define __dynamic_array(_type, _item) { \
+#undef __dynamic_field
+#define __dynamic_field(_type, _item) { \
.type = #_type "[]", .name = #_item, \
.size = 0, .align = __alignof__(_type), \
is_signed_type(_type), .filter_type = FILTER_OTHER },
@@ -170,8 +170,8 @@ static struct trace_event_fields ftrace_event_fields_##name[] = { \
#undef __array_desc
#define __array_desc(type, container, item, len)
-#undef __dynamic_array
-#define __dynamic_array(type, item)
+#undef __dynamic_field
+#define __dynamic_field(type, item)
#undef F_printk
#define F_printk(fmt, args...) __stringify(fmt) ", " __stringify(args)
--
2.53.0
reply other threads:[~2026-11-30 19:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261130144941.27cdb72d@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@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®