[1/4] tracing/osnoise: Fix duration type

Message ID a93d8a8378c7973e9c609de05826533c9e977939.1668692096.git.bristot@kernel.org
State New
Headers
Series Allow osnoise tracer to run without workload |

Commit Message

Daniel Bristot de Oliveira Nov. 17, 2022, 1:46 p.m. UTC
  The duration type is a 64 long value, not an int. This was
causing some long noise to report wrong values.

Change the duration to a 64 bits value.

Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 kernel/trace/trace_osnoise.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Masami Hiramatsu (Google) Nov. 21, 2022, 10:18 p.m. UTC | #1
On Thu, 17 Nov 2022 14:46:17 +0100
Daniel Bristot de Oliveira <bristot@kernel.org> wrote:

> The duration type is a 64 long value, not an int. This was
> causing some long noise to report wrong values.
> 
> Change the duration to a 64 bits value.

This looks good to me.

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

Thank you!

> 
> Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
> Cc: Daniel Bristot de Oliveira <bristot@kernel.org>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Masami Hiramatsu <mhiramat@kernel.org>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
> ---
>  kernel/trace/trace_osnoise.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
> index 78d536d3ff3d..4300c5dc4e5d 100644
> --- a/kernel/trace/trace_osnoise.c
> +++ b/kernel/trace/trace_osnoise.c
> @@ -917,7 +917,7 @@ void osnoise_trace_irq_entry(int id)
>  void osnoise_trace_irq_exit(int id, const char *desc)
>  {
>  	struct osnoise_variables *osn_var = this_cpu_osn_var();
> -	int duration;
> +	s64 duration;
>  
>  	if (!osn_var->sampling)
>  		return;
> @@ -1048,7 +1048,7 @@ static void trace_softirq_entry_callback(void *data, unsigned int vec_nr)
>  static void trace_softirq_exit_callback(void *data, unsigned int vec_nr)
>  {
>  	struct osnoise_variables *osn_var = this_cpu_osn_var();
> -	int duration;
> +	s64 duration;
>  
>  	if (!osn_var->sampling)
>  		return;
> @@ -1144,7 +1144,7 @@ thread_entry(struct osnoise_variables *osn_var, struct task_struct *t)
>  static void
>  thread_exit(struct osnoise_variables *osn_var, struct task_struct *t)
>  {
> -	int duration;
> +	s64 duration;
>  
>  	if (!osn_var->sampling)
>  		return;
> -- 
> 2.32.0
>
  
Daniel Bristot de Oliveira Nov. 22, 2022, 10:51 a.m. UTC | #2
On 11/21/22 23:18, Masami Hiramatsu (Google) wrote:
> On Thu, 17 Nov 2022 14:46:17 +0100
> Daniel Bristot de Oliveira <bristot@kernel.org> wrote:
> 
>> The duration type is a 64 long value, not an int. This was
>> causing some long noise to report wrong values.
>>
>> Change the duration to a 64 bits value.
> This looks good to me.
> 
> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thanks, Masami!

Btw, this patch can be applied independently of the other as a fix. It
is only here because I noticed the problem while adding the features in
the next patches.

-- Daniel
  

Patch

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 78d536d3ff3d..4300c5dc4e5d 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -917,7 +917,7 @@  void osnoise_trace_irq_entry(int id)
 void osnoise_trace_irq_exit(int id, const char *desc)
 {
 	struct osnoise_variables *osn_var = this_cpu_osn_var();
-	int duration;
+	s64 duration;
 
 	if (!osn_var->sampling)
 		return;
@@ -1048,7 +1048,7 @@  static void trace_softirq_entry_callback(void *data, unsigned int vec_nr)
 static void trace_softirq_exit_callback(void *data, unsigned int vec_nr)
 {
 	struct osnoise_variables *osn_var = this_cpu_osn_var();
-	int duration;
+	s64 duration;
 
 	if (!osn_var->sampling)
 		return;
@@ -1144,7 +1144,7 @@  thread_entry(struct osnoise_variables *osn_var, struct task_struct *t)
 static void
 thread_exit(struct osnoise_variables *osn_var, struct task_struct *t)
 {
-	int duration;
+	s64 duration;
 
 	if (!osn_var->sampling)
 		return;