* [PATCH v2 0/2] ftrace: Expose call graph depth as unsigned int
@ 2025-04-12 22:10 Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 1/2] ftrace: Fix type of ftrace_graph_ent_entry.depth Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 2/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
0 siblings, 2 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2025-04-12 22:10 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, Sven Schnelle, linux-kernel,
linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Ilya Leoshkevich
v1: https://lore.kernel.org/lkml/20250411172207.61332-1-iii@linux.ibm.com/
v1 -> v2: Use unsigned int instead of int.
Add a follow-up patch that changes depth to unsigned int in
all events.
Hi,
This series changes the type of depth in all call graph events to
unsigned int.
Patch 1 fixes a size mismatch issue in ftrace_graph_ent_entry, which
causes trace-cmd on 64-bit big-endian systems to output a lot of bogus
spaces, rendering it unusable.
Patch 2 changes type of depth in all other events to unsigned int in
order to better reflect its semantics: it can only be negative
internally, but recorded values are always non-negative.
Best regards,
Ilya
Ilya Leoshkevich (2):
ftrace: Fix type of ftrace_graph_ent_entry.depth
ftrace: Expose call graph depth as unsigned int
kernel/trace/trace_entries.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
--
2.49.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] ftrace: Fix type of ftrace_graph_ent_entry.depth
2025-04-12 22:10 [PATCH v2 0/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
@ 2025-04-12 22:10 ` Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 2/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
1 sibling, 0 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2025-04-12 22:10 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, Sven Schnelle, linux-kernel,
linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Ilya Leoshkevich
ftrace_graph_ent.depth is int, but ftrace_graph_ent_entry.depth is
unsigned long. This confuses trace-cmd on 64-bit big-endian systems and
makes it print a huge amount of spaces. Fix this by using unsigned int,
which has a matching size, instead.
Fixes: ff5c9c576e75 ("ftrace: Add support for function argument to graph tracer")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
kernel/trace/trace_entries.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index ee40d4e6ad1c..4ef4df6623a8 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -80,11 +80,11 @@ FTRACE_ENTRY(funcgraph_entry, ftrace_graph_ent_entry,
F_STRUCT(
__field_struct( struct ftrace_graph_ent, graph_ent )
__field_packed( unsigned long, graph_ent, func )
- __field_packed( unsigned long, graph_ent, depth )
+ __field_packed( unsigned int, graph_ent, depth )
__dynamic_array(unsigned long, args )
),
- F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
+ F_printk("--> %ps (%u)", (void *)__entry->func, __entry->depth)
);
#ifdef CONFIG_FUNCTION_GRAPH_RETADDR
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] ftrace: Expose call graph depth as unsigned int
2025-04-12 22:10 [PATCH v2 0/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 1/2] ftrace: Fix type of ftrace_graph_ent_entry.depth Ilya Leoshkevich
@ 2025-04-12 22:10 ` Ilya Leoshkevich
1 sibling, 0 replies; 3+ messages in thread
From: Ilya Leoshkevich @ 2025-04-12 22:10 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu
Cc: Mathieu Desnoyers, Sven Schnelle, linux-kernel,
linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev, Ilya Leoshkevich
Depth is stored as int because the code uses negative values to break
out of iterations. But what is recorded is always zero or positive. So
expose it as unsigned int instead of int.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
kernel/trace/trace_entries.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h
index 4ef4df6623a8..de294ae2c5c5 100644
--- a/kernel/trace/trace_entries.h
+++ b/kernel/trace/trace_entries.h
@@ -97,11 +97,11 @@ FTRACE_ENTRY_PACKED(fgraph_retaddr_entry, fgraph_retaddr_ent_entry,
F_STRUCT(
__field_struct( struct fgraph_retaddr_ent, graph_ent )
__field_packed( unsigned long, graph_ent, func )
- __field_packed( int, graph_ent, depth )
+ __field_packed( unsigned int, graph_ent, depth )
__field_packed( unsigned long, graph_ent, retaddr )
),
- F_printk("--> %ps (%d) <- %ps", (void *)__entry->func, __entry->depth,
+ F_printk("--> %ps (%u) <- %ps", (void *)__entry->func, __entry->depth,
(void *)__entry->retaddr)
);
@@ -124,13 +124,13 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry,
__field_struct( struct ftrace_graph_ret, ret )
__field_packed( unsigned long, ret, func )
__field_packed( unsigned long, ret, retval )
- __field_packed( int, ret, depth )
+ __field_packed( unsigned int, ret, depth )
__field_packed( unsigned int, ret, overrun )
__field(unsigned long long, calltime )
__field(unsigned long long, rettime )
),
- F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d retval: %lx",
+ F_printk("<-- %ps (%u) (start: %llx end: %llx) over: %u retval: %lx",
(void *)__entry->func, __entry->depth,
__entry->calltime, __entry->rettime,
__entry->depth, __entry->retval)
@@ -146,13 +146,13 @@ FTRACE_ENTRY_PACKED(funcgraph_exit, ftrace_graph_ret_entry,
F_STRUCT(
__field_struct( struct ftrace_graph_ret, ret )
__field_packed( unsigned long, ret, func )
- __field_packed( int, ret, depth )
+ __field_packed( unsigned int, ret, depth )
__field_packed( unsigned int, ret, overrun )
__field(unsigned long long, calltime )
__field(unsigned long long, rettime )
),
- F_printk("<-- %ps (%d) (start: %llx end: %llx) over: %d",
+ F_printk("<-- %ps (%u) (start: %llx end: %llx) over: %u",
(void *)__entry->func, __entry->depth,
__entry->calltime, __entry->rettime,
__entry->depth)
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-12 22:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 22:10 [PATCH v2 0/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 1/2] ftrace: Fix type of ftrace_graph_ent_entry.depth Ilya Leoshkevich
2025-04-12 22:10 ` [PATCH v2 2/2] ftrace: Expose call graph depth as unsigned int Ilya Leoshkevich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).