* [PATCH] perf stat: Fix duration_time value for higher intervals
@ 2020-05-18 13:14 Jiri Olsa
2020-05-18 15:23 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Olsa @ 2020-05-18 13:14 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Joakim Zhang, lkml, Ingo Molnar, Namhyung Kim,
Alexander Shishkin, Peter Zijlstra, Michael Petlan
Joakim reported wrong duration_time value for interval bigger
than 4000 [1].
The problem is in the interval value we pass to update_stats
function, which is typed as 'unsigned int' and overflows when
we get over 2^32 (happens between intervals 4000 and 5000).
Retyping the passed value to unsigned long long.
[1] https://www.spinics.net/lists/linux-perf-users/msg11777.html
Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/builtin-stat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index e0c1ad23c768..4deb2d46a343 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -367,7 +367,7 @@ static void process_interval(void)
}
init_stats(&walltime_nsecs_stats);
- update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000);
+ update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000ULL);
print_counters(&rs, 0, NULL);
}
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] perf stat: Fix duration_time value for higher intervals
2020-05-18 13:14 [PATCH] perf stat: Fix duration_time value for higher intervals Jiri Olsa
@ 2020-05-18 15:23 ` Arnaldo Carvalho de Melo
2020-05-18 15:48 ` Jiri Olsa
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-05-18 15:23 UTC (permalink / raw)
To: Jiri Olsa
Cc: Joakim Zhang, Andi Kleen, lkml, Ingo Molnar, Namhyung Kim,
Alexander Shishkin, Peter Zijlstra, Michael Petlan
Em Mon, May 18, 2020 at 03:14:45PM +0200, Jiri Olsa escreveu:
> Joakim reported wrong duration_time value for interval bigger
> than 4000 [1].
>
> The problem is in the interval value we pass to update_stats
> function, which is typed as 'unsigned int' and overflows when
> we get over 2^32 (happens between intervals 4000 and 5000).
>
> Retyping the passed value to unsigned long long.
Thanks, applied and added this:
Fixes: b90f1333ef08 ("perf stat: Update walltime_nsecs_stats in interval mode")
Ok?
- Arnaldo
> [1] https://www.spinics.net/lists/linux-perf-users/msg11777.html
>
> Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/builtin-stat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> index e0c1ad23c768..4deb2d46a343 100644
> --- a/tools/perf/builtin-stat.c
> +++ b/tools/perf/builtin-stat.c
> @@ -367,7 +367,7 @@ static void process_interval(void)
> }
>
> init_stats(&walltime_nsecs_stats);
> - update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000);
> + update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000ULL);
> print_counters(&rs, 0, NULL);
> }
>
> --
> 2.25.4
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] perf stat: Fix duration_time value for higher intervals
2020-05-18 15:23 ` Arnaldo Carvalho de Melo
@ 2020-05-18 15:48 ` Jiri Olsa
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Olsa @ 2020-05-18 15:48 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Jiri Olsa, Joakim Zhang, Andi Kleen, lkml, Ingo Molnar,
Namhyung Kim, Alexander Shishkin, Peter Zijlstra, Michael Petlan
On Mon, May 18, 2020 at 12:23:51PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, May 18, 2020 at 03:14:45PM +0200, Jiri Olsa escreveu:
> > Joakim reported wrong duration_time value for interval bigger
> > than 4000 [1].
> >
> > The problem is in the interval value we pass to update_stats
> > function, which is typed as 'unsigned int' and overflows when
> > we get over 2^32 (happens between intervals 4000 and 5000).
> >
> > Retyping the passed value to unsigned long long.
>
> Thanks, applied and added this:
>
> Fixes: b90f1333ef08 ("perf stat: Update walltime_nsecs_stats in interval mode")
>
> Ok?
yep, thanks
jirka
>
> - Arnaldo
>
> > [1] https://www.spinics.net/lists/linux-perf-users/msg11777.html
> >
> > Reported-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/builtin-stat.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
> > index e0c1ad23c768..4deb2d46a343 100644
> > --- a/tools/perf/builtin-stat.c
> > +++ b/tools/perf/builtin-stat.c
> > @@ -367,7 +367,7 @@ static void process_interval(void)
> > }
> >
> > init_stats(&walltime_nsecs_stats);
> > - update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000);
> > + update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000ULL);
> > print_counters(&rs, 0, NULL);
> > }
> >
> > --
> > 2.25.4
> >
>
> --
>
> - Arnaldo
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-18 15:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 13:14 [PATCH] perf stat: Fix duration_time value for higher intervals Jiri Olsa
2020-05-18 15:23 ` Arnaldo Carvalho de Melo
2020-05-18 15:48 ` Jiri Olsa
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).