ftrace: Expose call graph depth as unsigned int
authorIlya Leoshkevich <iii@linux.ibm.com>
Sat, 12 Apr 2025 22:10:44 +0000 (00:10 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 8 May 2025 13:36:08 +0000 (09:36 -0400)
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.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/20250412221847.17310-3-iii@linux.ibm.com
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_entries.h

index 4ef4df6623a8d37a2e624679cb24ae72aa292ce1..de294ae2c5c5a94630b91cc19cb43bf74140b09e 100644 (file)
@@ -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)