linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing/synthetic: Print out u64 values properly
@ 2023-09-11 14:17 Tero Kristo
  2023-09-15  6:01 ` Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Tero Kristo @ 2023-09-11 14:17 UTC (permalink / raw)
  To: rostedt, mhiramat
  Cc: artem.bityutskiy, linux-trace-kernel, linux-kernel, stable

The synth traces incorrectly print pointer to the synthetic event values
instead of the actual value when using u64 type. Fix by addressing the
contents of the union properly.

Fixes: ddeea494a16f ("tracing/synthetic: Use union instead of casts")
Cc: stable@vger.kernel.org
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 kernel/trace/trace_events_synth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
index 7fff8235075f..070365959c0a 100644
--- a/kernel/trace/trace_events_synth.c
+++ b/kernel/trace/trace_events_synth.c
@@ -337,7 +337,7 @@ static void print_synth_event_num_val(struct trace_seq *s,
 		break;
 
 	default:
-		trace_seq_printf(s, print_fmt, name, val, space);
+		trace_seq_printf(s, print_fmt, name, val->as_u64, space);
 		break;
 	}
 }
-- 
2.40.1


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

* Re: [PATCH] tracing/synthetic: Print out u64 values properly
  2023-09-11 14:17 [PATCH] tracing/synthetic: Print out u64 values properly Tero Kristo
@ 2023-09-15  6:01 ` Masami Hiramatsu
  2023-09-15 10:46   ` Tero Kristo
  0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2023-09-15  6:01 UTC (permalink / raw)
  To: Tero Kristo
  Cc: rostedt, artem.bityutskiy, linux-trace-kernel, linux-kernel,
	stable

Hi Tero,

On Mon, 11 Sep 2023 17:17:04 +0300
Tero Kristo <tero.kristo@linux.intel.com> wrote:

> The synth traces incorrectly print pointer to the synthetic event values
> instead of the actual value when using u64 type. Fix by addressing the
> contents of the union properly.

Thanks for pointing it out.
But I would like to see a new "case 8:" print code instead of changing
"default". Can you keep the default as it is and add "case 8:" case there?

Thanks,

> 
> Fixes: ddeea494a16f ("tracing/synthetic: Use union instead of casts")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
> ---
>  kernel/trace/trace_events_synth.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
> index 7fff8235075f..070365959c0a 100644
> --- a/kernel/trace/trace_events_synth.c
> +++ b/kernel/trace/trace_events_synth.c
> @@ -337,7 +337,7 @@ static void print_synth_event_num_val(struct trace_seq *s,
>  		break;
>  
>  	default:
> -		trace_seq_printf(s, print_fmt, name, val, space);
> +		trace_seq_printf(s, print_fmt, name, val->as_u64, space);
>  		break;
>  	}
>  }
> -- 
> 2.40.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH] tracing/synthetic: Print out u64 values properly
  2023-09-15  6:01 ` Masami Hiramatsu
@ 2023-09-15 10:46   ` Tero Kristo
  2023-09-15 14:16     ` Masami Hiramatsu
  0 siblings, 1 reply; 5+ messages in thread
From: Tero Kristo @ 2023-09-15 10:46 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: rostedt, artem.bityutskiy, linux-trace-kernel, linux-kernel,
	stable

Hi Masami,

On 15/09/2023 09:01, Masami Hiramatsu (Google) wrote:
> Hi Tero,
>
> On Mon, 11 Sep 2023 17:17:04 +0300
> Tero Kristo <tero.kristo@linux.intel.com> wrote:
>
>> The synth traces incorrectly print pointer to the synthetic event values
>> instead of the actual value when using u64 type. Fix by addressing the
>> contents of the union properly.
> Thanks for pointing it out.
> But I would like to see a new "case 8:" print code instead of changing
> "default". Can you keep the default as it is and add "case 8:" case there?

Are you sure about that? I think keeping the default as is would just 
print out a useless pointer value to the synth event itself (which is 
what happened with u64 type.)

Anyways, that requires a new patch to be created on top as this has hit 
the mainline as a fix already.

-Tero


>
> Thanks,
>
>> Fixes: ddeea494a16f ("tracing/synthetic: Use union instead of casts")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
>> ---
>>   kernel/trace/trace_events_synth.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
>> index 7fff8235075f..070365959c0a 100644
>> --- a/kernel/trace/trace_events_synth.c
>> +++ b/kernel/trace/trace_events_synth.c
>> @@ -337,7 +337,7 @@ static void print_synth_event_num_val(struct trace_seq *s,
>>   		break;
>>   
>>   	default:
>> -		trace_seq_printf(s, print_fmt, name, val, space);
>> +		trace_seq_printf(s, print_fmt, name, val->as_u64, space);
>>   		break;
>>   	}
>>   }
>> -- 
>> 2.40.1
>>
>

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

* Re: [PATCH] tracing/synthetic: Print out u64 values properly
  2023-09-15 10:46   ` Tero Kristo
@ 2023-09-15 14:16     ` Masami Hiramatsu
  2023-09-15 14:38       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Masami Hiramatsu @ 2023-09-15 14:16 UTC (permalink / raw)
  To: Tero Kristo
  Cc: rostedt, artem.bityutskiy, linux-trace-kernel, linux-kernel,
	stable

Hi Tero,

On Fri, 15 Sep 2023 13:46:45 +0300
Tero Kristo <tero.kristo@linux.intel.com> wrote:

> Hi Masami,
> 
> On 15/09/2023 09:01, Masami Hiramatsu (Google) wrote:
> > Hi Tero,
> >
> > On Mon, 11 Sep 2023 17:17:04 +0300
> > Tero Kristo <tero.kristo@linux.intel.com> wrote:
> >
> >> The synth traces incorrectly print pointer to the synthetic event values
> >> instead of the actual value when using u64 type. Fix by addressing the
> >> contents of the union properly.
> > Thanks for pointing it out.
> > But I would like to see a new "case 8:" print code instead of changing
> > "default". Can you keep the default as it is and add "case 8:" case there?
> 
> Are you sure about that? I think keeping the default as is would just 
> print out a useless pointer value to the synth event itself (which is 
> what happened with u64 type.)

Yeah, I think the "default" here means no correct way to show the value
in it. So anyway, if we know the size is 8 and there is val->as_u64,
there should be "case 8:".

> 
> Anyways, that requires a new patch to be created on top as this has hit 
> the mainline as a fix already.

Oops, I missed that.

Thank you!

> 
> -Tero
> 
> 
> >
> > Thanks,
> >
> >> Fixes: ddeea494a16f ("tracing/synthetic: Use union instead of casts")
> >> Cc: stable@vger.kernel.org
> >> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
> >> ---
> >>   kernel/trace/trace_events_synth.c | 2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_synth.c
> >> index 7fff8235075f..070365959c0a 100644
> >> --- a/kernel/trace/trace_events_synth.c
> >> +++ b/kernel/trace/trace_events_synth.c
> >> @@ -337,7 +337,7 @@ static void print_synth_event_num_val(struct trace_seq *s,
> >>   		break;
> >>   
> >>   	default:
> >> -		trace_seq_printf(s, print_fmt, name, val, space);
> >> +		trace_seq_printf(s, print_fmt, name, val->as_u64, space);
> >>   		break;
> >>   	}
> >>   }
> >> -- 
> >> 2.40.1
> >>
> >


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

* Re: [PATCH] tracing/synthetic: Print out u64 values properly
  2023-09-15 14:16     ` Masami Hiramatsu
@ 2023-09-15 14:38       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2023-09-15 14:38 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Tero Kristo, artem.bityutskiy, linux-trace-kernel, linux-kernel,
	stable

On Fri, 15 Sep 2023 23:16:13 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> > Anyways, that requires a new patch to be created on top as this has hit 
> > the mainline as a fix already.  
> 
> Oops, I missed that.

Yeah, I took that because it matched the original case, which was it being u64.

-- Steve

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

end of thread, other threads:[~2023-09-15 14:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-11 14:17 [PATCH] tracing/synthetic: Print out u64 values properly Tero Kristo
2023-09-15  6:01 ` Masami Hiramatsu
2023-09-15 10:46   ` Tero Kristo
2023-09-15 14:16     ` Masami Hiramatsu
2023-09-15 14:38       ` 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).