linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth
@ 2025-04-11 17:21 Ilya Leoshkevich
  2025-04-12 16:07 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Leoshkevich @ 2025-04-11 17:21 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 big-endian systems and makes
it print a huge amount of spaces. Make the types match.

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..ac6374b47fe3 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(	int,		graph_ent,	depth		)
 		__dynamic_array(unsigned long,	args				)
 	),
 
-	F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
+	F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)
 );
 
 #ifdef CONFIG_FUNCTION_GRAPH_RETADDR
-- 
2.49.0


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

* Re: [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth
  2025-04-11 17:21 [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth Ilya Leoshkevich
@ 2025-04-12 16:07 ` Steven Rostedt
  2025-04-12 21:01   ` Ilya Leoshkevich
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2025-04-12 16:07 UTC (permalink / raw)
  To: Ilya Leoshkevich
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Sven Schnelle, linux-kernel,
	linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev

On Fri, 11 Apr 2025 19:21:41 +0200
Ilya Leoshkevich <iii@linux.ibm.com> wrote:

>  
> -	F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
> +	F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)

depth should never be negative. Why did you use "%d" and not "%u" ?

-- Steve

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

* Re: [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth
  2025-04-12 16:07 ` Steven Rostedt
@ 2025-04-12 21:01   ` Ilya Leoshkevich
  2025-04-12 21:21     ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Leoshkevich @ 2025-04-12 21:01 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Sven Schnelle, linux-kernel,
	linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev

On 2025-04-12 18:07, Steven Rostedt wrote:
> On Fri, 11 Apr 2025 19:21:41 +0200
> Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> 
>> 
>> -	F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
>> +	F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)
> 
> depth should never be negative. Why did you use "%d" and not "%u" ?
> 
> -- Steve

I used int, because it's int in ftrace_graph_ent and all other events.
If you think it's a good idea, I can change them all to unsigned int in 
a follow-up patch.

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

* Re: [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth
  2025-04-12 21:01   ` Ilya Leoshkevich
@ 2025-04-12 21:21     ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2025-04-12 21:21 UTC (permalink / raw)
  To: Ilya Leoshkevich
  Cc: Masami Hiramatsu, Mathieu Desnoyers, Sven Schnelle, linux-kernel,
	linux-trace-kernel, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev

On Sat, 12 Apr 2025 23:01:05 +0200
Ilya Leoshkevich <iii@linux.ibm.com> wrote:

> On 2025-04-12 18:07, Steven Rostedt wrote:
> > On Fri, 11 Apr 2025 19:21:41 +0200
> > Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> >   
> >> 
> >> -	F_printk("--> %ps (%lu)", (void *)__entry->func, __entry->depth)
> >> +	F_printk("--> %ps (%d)", (void *)__entry->func, __entry->depth)  
> > 
> > depth should never be negative. Why did you use "%d" and not "%u" ?
> > 
> > -- Steve  
> 
> I used int, because it's int in ftrace_graph_ent and all other events.
> If you think it's a good idea, I can change them all to unsigned int in 
> a follow-up patch.

Hmm, a change like that should have been in the change log and explained.

The reason the code has int is because it uses negative depth to break
out of iterations and such. But what is recorded is always zero or
positive.

Yeah, let's keep it exposed as unsigned int.

Thanks,

-- Stene

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

end of thread, other threads:[~2025-04-12 21:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 17:21 [PATCH] ftrace: Fix type of ftrace_graph_ent_entry.depth Ilya Leoshkevich
2025-04-12 16:07 ` Steven Rostedt
2025-04-12 21:01   ` Ilya Leoshkevich
2025-04-12 21:21     ` Steven Rostedt

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).