* [PATCH 26/31] perf stat: Reset previous counts on repeat with interval [not found] <20190920142542.12047-1-acme@kernel.org> @ 2019-09-20 14:25 ` Arnaldo Carvalho de Melo [not found] ` <20190921120623.7B67920717@mail.kernel.org> 2019-09-20 14:25 ` [PATCH 27/31] perf stat: Fix a segmentation fault when using repeat forever Arnaldo Carvalho de Melo 1 sibling, 1 reply; 5+ messages in thread From: Arnaldo Carvalho de Melo @ 2019-09-20 14:25 UTC (permalink / raw) To: Ingo Molnar, Thomas Gleixner Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel, linux-perf-users, Srikar Dronamraju, Arnaldo Carvalho de Melo, Ravi Bangoria, Naveen N . Rao, Stephane Eranian, stable From: Srikar Dronamraju <srikar@linux.vnet.ibm.com> When using 'perf stat' with repeat and interval option, it shows wrong values for events. The wrong values will be shown for the first interval on the second and subsequent repetitions. Without the fix: # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5 2.000282489 53 faults 2.000282489 513 sched:sched_switch 4.005478208 3,721 faults 4.005478208 2,666 sched:sched_switch 5.025470933 395 faults 5.025470933 1,307 sched:sched_switch 2.009602825 1,84,46,74,40,73,70,95,47,520 faults <------ 2.009602825 1,84,46,74,40,73,70,95,49,568 sched:sched_switch <------ 4.019612206 4,730 faults 4.019612206 2,746 sched:sched_switch 5.039615484 3,953 faults 5.039615484 1,496 sched:sched_switch 2.000274620 1,84,46,74,40,73,70,95,47,520 faults <------ 2.000274620 1,84,46,74,40,73,70,95,47,520 sched:sched_switch <------ 4.000480342 4,282 faults 4.000480342 2,303 sched:sched_switch 5.000916811 1,322 faults 5.000916811 1,064 sched:sched_switch # prev_raw_counts is allocated when using intervals. This is used when calculating the difference in the counts of events when using interval. The current counts are stored in prev_raw_counts to calculate the differences in the next iteration. On the first interval of the second and subsequent repetitions, prev_raw_counts would be the values stored in the last interval of the previous repetitions, while the current counts will only be for the first interval of the current repetition. Hence there is a possibility of events showing up as big number. Fix this by resetting prev_raw_counts whenever perf stat repeats the command. With the fix: # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5 2.019349347 2,597 faults 2.019349347 2,753 sched:sched_switch 4.019577372 3,098 faults 4.019577372 2,532 sched:sched_switch 5.019415481 1,879 faults 5.019415481 1,356 sched:sched_switch 2.000178813 8,468 faults 2.000178813 2,254 sched:sched_switch 4.000404621 7,440 faults 4.000404621 1,266 sched:sched_switch 5.040196079 2,458 faults 5.040196079 556 sched:sched_switch 2.000191939 6,870 faults 2.000191939 1,170 sched:sched_switch 4.000414103 541 faults 4.000414103 902 sched:sched_switch 5.000809863 450 faults 5.000809863 364 sched:sched_switch # Committer notes: This was broken since the cset introducing the --interval feature, i.e. --repeat + --interval wasn't tested at that point, add the Fixes tag so that automatic scripts can pick this up. Fixes: 13370a9b5bb8 ("perf stat: Add interval printing") Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Stephane Eranian <eranian@google.com> Cc: stable@vger.kernel.org # v3.9+ Link: http://lore.kernel.org/lkml/20190904094738.9558-2-srikar@linux.vnet.ibm.com [ Fixed up conflicts with libperf, i.e. some perf_{evsel,evlist} lost the 'perf' prefix ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-stat.c | 3 +++ tools/perf/util/stat.c | 17 +++++++++++++++++ tools/perf/util/stat.h | 1 + 3 files changed, 21 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index eece3d1e429a..fa4b148ecfca 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1952,6 +1952,9 @@ int cmd_stat(int argc, const char **argv) fprintf(output, "[ perf stat: executing run #%d ... ]\n", run_idx + 1); + if (run_idx != 0) + perf_evlist__reset_prev_raw_counts(evsel_list); + status = run_perf_stat(argc, argv, run_idx); if (forever && status != -1) { print_counters(NULL, argc, argv); diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index 06571209cb0b..fcd54342c04c 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -162,6 +162,15 @@ static void perf_evsel__free_prev_raw_counts(struct evsel *evsel) evsel->prev_raw_counts = NULL; } +static void perf_evsel__reset_prev_raw_counts(struct evsel *evsel) +{ + if (evsel->prev_raw_counts) { + evsel->prev_raw_counts->aggr.val = 0; + evsel->prev_raw_counts->aggr.ena = 0; + evsel->prev_raw_counts->aggr.run = 0; + } +} + static int perf_evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) { int ncpus = perf_evsel__nr_cpus(evsel); @@ -212,6 +221,14 @@ void perf_evlist__reset_stats(struct evlist *evlist) } } +void perf_evlist__reset_prev_raw_counts(struct evlist *evlist) +{ + struct evsel *evsel; + + evlist__for_each_entry(evlist, evsel) + perf_evsel__reset_prev_raw_counts(evsel); +} + static void zero_per_pkg(struct evsel *counter) { if (counter->per_pkg_mask) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 0f9c9f6e2041..edbeb2f63e8d 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -193,6 +193,7 @@ void perf_stat__collect_metric_expr(struct evlist *); int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw); void perf_evlist__free_stats(struct evlist *evlist); void perf_evlist__reset_stats(struct evlist *evlist); +void perf_evlist__reset_prev_raw_counts(struct evlist *evlist); int perf_stat_process_counter(struct perf_stat_config *config, struct evsel *counter); -- 2.21.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <20190921120623.7B67920717@mail.kernel.org>]
* Re: [PATCH 26/31] perf stat: Reset previous counts on repeat with interval [not found] ` <20190921120623.7B67920717@mail.kernel.org> @ 2019-09-23 16:28 ` Srikar Dronamraju 2019-09-23 17:37 ` Arnaldo Carvalho de Melo 2019-09-24 6:17 ` Srikar Dronamraju 1 sibling, 1 reply; 5+ messages in thread From: Srikar Dronamraju @ 2019-09-23 16:28 UTC (permalink / raw) To: Sasha Levin Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa, Namhyung Kim, Naveen N. Rao, Stephane Eranian, stable Hi Sasha, Arnaldo. Between v5.2.16 and acme HEAD, struct perf_evlist to struct evlist and struct perf_evsel to struct evsel. However the patches that I had posted http://lkml.kernel.org/r/20190904094738.9558-2-srikar@linux.vnet.ibm.com would apply cleanly to v5.2.16. I would like to check if the backports to v5.2.16 should be the same patch (i.e include dependencies including struct renames) or is it okay to apply without the dependencies. Please advise. Because the renames affected a lot of files, it throws up a lot of commits as dependencies. So I would wait for your inputs before I start with the work. -- Thanks and Regards Srikar > > The bot has tested the following trees: v5.2.16, v4.19.74, v4.14.145, v4.9.193, v4.4.193. > > v5.2.16: Failed to apply! Possible dependencies: > 1c839a5a4061 ("perf cs-etm: Configure timestamp generation in CPU-wide mode") > 32dcd021d004 ("perf evsel: Rename struct perf_evsel to struct evsel") > 3399ad9ac234 ("perf cs-etm: Configure contextID tracing in CPU-wide mode") > acae8b36cded ("perf header: Add die information in CPU topology") > b74d8686a18b ("perf cpumap: Retrieve die id information") > db5742b6849e ("perf stat: Support per-die aggregation") > f854839ba2a5 ("perf cpu_map: Rename struct cpu_map to struct perf_cpu_map") > -- Thanks and Regards Srikar Dronamraju ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 26/31] perf stat: Reset previous counts on repeat with interval 2019-09-23 16:28 ` Srikar Dronamraju @ 2019-09-23 17:37 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 5+ messages in thread From: Arnaldo Carvalho de Melo @ 2019-09-23 17:37 UTC (permalink / raw) To: Srikar Dronamraju Cc: Sasha Levin, Ingo Molnar, Jiri Olsa, Namhyung Kim, Naveen N. Rao, Stephane Eranian, stable Em Mon, Sep 23, 2019 at 09:58:54PM +0530, Srikar Dronamraju escreveu: > Hi Sasha, Arnaldo. > > Between v5.2.16 and acme HEAD, struct perf_evlist to struct evlist and > struct perf_evsel to struct evsel. > > However the patches that I had posted > http://lkml.kernel.org/r/20190904094738.9558-2-srikar@linux.vnet.ibm.com > would apply cleanly to v5.2.16. > > I would like to check if the backports to v5.2.16 should be the same patch > (i.e include dependencies including struct renames) or is it okay to apply > without the dependencies. Please advise. > > Because the renames affected a lot of files, it throws up a lot of commits > as dependencies. So I would wait for your inputs before I start with the > work. Better to not drag the renames, just use the original patch, I think its the best path forward (well, backward :)). - Arnaldo > -- > Thanks and Regards > Srikar > > > > > > The bot has tested the following trees: v5.2.16, v4.19.74, v4.14.145, v4.9.193, v4.4.193. > > > > v5.2.16: Failed to apply! Possible dependencies: > > 1c839a5a4061 ("perf cs-etm: Configure timestamp generation in CPU-wide mode") > > 32dcd021d004 ("perf evsel: Rename struct perf_evsel to struct evsel") > > 3399ad9ac234 ("perf cs-etm: Configure contextID tracing in CPU-wide mode") > > acae8b36cded ("perf header: Add die information in CPU topology") > > b74d8686a18b ("perf cpumap: Retrieve die id information") > > db5742b6849e ("perf stat: Support per-die aggregation") > > f854839ba2a5 ("perf cpu_map: Rename struct cpu_map to struct perf_cpu_map") > > > > -- > Thanks and Regards > Srikar Dronamraju -- - Arnaldo ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 26/31] perf stat: Reset previous counts on repeat with interval [not found] ` <20190921120623.7B67920717@mail.kernel.org> 2019-09-23 16:28 ` Srikar Dronamraju @ 2019-09-24 6:17 ` Srikar Dronamraju 1 sibling, 0 replies; 5+ messages in thread From: Srikar Dronamraju @ 2019-09-24 6:17 UTC (permalink / raw) To: Sasha Levin Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Jiri Olsa, Namhyung Kim, Naveen N. Rao, Stephane Eranian, stable Hi Sasha, > > This commit has been processed because it contains a "Fixes:" tag, > fixing commit: 13370a9b5bb8 perf stat: Add interval printing. > > The bot has tested the following trees: v5.2.16, v4.19.74, v4.14.145, v4.9.193, v4.4.193. > > v5.2.16: Failed to apply! Possible dependencies: > 1c839a5a4061 ("perf cs-etm: Configure timestamp generation in CPU-wide mode") > 32dcd021d004 ("perf evsel: Rename struct perf_evsel to struct evsel") > 3399ad9ac234 ("perf cs-etm: Configure contextID tracing in CPU-wide mode") > acae8b36cded ("perf header: Add die information in CPU topology") > b74d8686a18b ("perf cpumap: Retrieve die id information") > db5742b6849e ("perf stat: Support per-die aggregation") > f854839ba2a5 ("perf cpu_map: Rename struct cpu_map to struct perf_cpu_map") > > v4.19.74: Failed to apply! Possible dependencies: > 121dd9ea0116 ("perf bench: Add epoll parallel epoll_wait benchmark") > 1c839a5a4061 ("perf cs-etm: Configure timestamp generation in CPU-wide mode") > 231457ec7074 ("perf bench: Add epoll_ctl(2) benchmark") > 32dcd021d004 ("perf evsel: Rename struct perf_evsel to struct evsel") > 3399ad9ac234 ("perf cs-etm: Configure contextID tracing in CPU-wide mode") > 6ca9a082b190 ("perf stat: Pass a 'struct perf_stat_config' argument to global print functions") > 6f6b6594b5f3 ("perf stat: Move *_aggr_* data to 'struct perf_stat_config'") > 77e0faf8552c ("perf stat: Pass 'evlist' to aggr_update_shadow()") > 8897a8916efb ("perf stat: Move ru_* data to 'struct perf_stat_config'") > ae2d7da554f0 ("perf stat: Pass 'struct perf_stat_config' to first_shadow_cpu()") > d97ae04b3d52 ("perf stat: Move 'run_count' to 'struct perf_stat_config'") > df4f7b4d4b1e ("perf stat: Move 'unit_width' to 'struct perf_stat_config'") > f3ca50e61ff4 ("perf stat: Pass 'struct perf_stat_config' argument to local print functions") > f854839ba2a5 ("perf cpu_map: Rename struct cpu_map to struct perf_cpu_map") > fa4e819bbca9 ("perf arm cs-etm: Use event attributes to send sink information to kernel") > fa7070a38676 ("perf stat: Move csv_* to 'struct perf_stat_config'") > As suggested by Arnaldo, I am adding my patch which applies and builds well on v5.2.16 and v4.14.145. This one differs from the one committed by Arnaldo with respect to structure name change. Meanwhile I will investigate on v4.14.145 v4.9.193 v4.4.193 and get back to to you. -- Thanks and Regards Srikar Dronamraju ---->8------------8<----------------- From b63fd11cced17fcb8e133def29001b0f6aaa5e06 Mon Sep 17 00:00:00 2001 From: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Date: Wed, 4 Sep 2019 15:17:37 +0530 Subject: [PATCH 1/2] perf stat: Reset previous counts on repeat with interval When using 'perf stat' with repeat and interval option, it shows wrong values for events. The wrong values will be shown for the first interval on the second and subsequent repetitions. Without the fix: # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5 2.000282489 53 faults 2.000282489 513 sched:sched_switch 4.005478208 3,721 faults 4.005478208 2,666 sched:sched_switch 5.025470933 395 faults 5.025470933 1,307 sched:sched_switch 2.009602825 1,84,46,74,40,73,70,95,47,520 faults <------ 2.009602825 1,84,46,74,40,73,70,95,49,568 sched:sched_switch <------ 4.019612206 4,730 faults 4.019612206 2,746 sched:sched_switch 5.039615484 3,953 faults 5.039615484 1,496 sched:sched_switch 2.000274620 1,84,46,74,40,73,70,95,47,520 faults <------ 2.000274620 1,84,46,74,40,73,70,95,47,520 sched:sched_switch <------ 4.000480342 4,282 faults 4.000480342 2,303 sched:sched_switch 5.000916811 1,322 faults 5.000916811 1,064 sched:sched_switch # prev_raw_counts is allocated when using intervals. This is used when calculating the difference in the counts of events when using interval. The current counts are stored in prev_raw_counts to calculate the differences in the next iteration. On the first interval of the second and subsequent repetitions, prev_raw_counts would be the values stored in the last interval of the previous repetitions, while the current counts will only be for the first interval of the current repetition. Hence there is a possibility of events showing up as big number. Fix this by resetting prev_raw_counts whenever perf stat repeats the command. With the fix: # perf stat -r 3 -I 2000 -e faults -e sched:sched_switch -a sleep 5 2.019349347 2,597 faults 2.019349347 2,753 sched:sched_switch 4.019577372 3,098 faults 4.019577372 2,532 sched:sched_switch 5.019415481 1,879 faults 5.019415481 1,356 sched:sched_switch 2.000178813 8,468 faults 2.000178813 2,254 sched:sched_switch 4.000404621 7,440 faults 4.000404621 1,266 sched:sched_switch 5.040196079 2,458 faults 5.040196079 556 sched:sched_switch 2.000191939 6,870 faults 2.000191939 1,170 sched:sched_switch 4.000414103 541 faults 4.000414103 902 sched:sched_switch 5.000809863 450 faults 5.000809863 364 sched:sched_switch # Committer notes: This was broken since the cset introducing the --interval feature, i.e. --repeat + --interval wasn't tested at that point, add the Fixes tag so that automatic scripts can pick this up. Fixes: 13370a9b5bb8 ("perf stat: Add interval printing") Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: Stephane Eranian <eranian@google.com> Cc: stable@vger.kernel.org # v3.9+ Link: http://lore.kernel.org/lkml/20190904094738.9558-2-srikar@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- tools/perf/builtin-stat.c | 3 +++ tools/perf/util/stat.c | 17 +++++++++++++++++ tools/perf/util/stat.h | 1 + 3 files changed, 21 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 352cf39d7c2f..eda451842bfd 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1961,6 +1961,9 @@ int cmd_stat(int argc, const char **argv) fprintf(output, "[ perf stat: executing run #%d ... ]\n", run_idx + 1); + if (run_idx != 0) + perf_evlist__reset_prev_raw_counts(evsel_list); + status = run_perf_stat(argc, argv, run_idx); if (forever && status != -1) { print_counters(NULL, argc, argv); diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index db8a6cf336be..773f29d4f6a7 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -155,6 +155,15 @@ static void perf_evsel__free_prev_raw_counts(struct perf_evsel *evsel) evsel->prev_raw_counts = NULL; } +static void perf_evsel__reset_prev_raw_counts(struct perf_evsel *evsel) +{ + if (evsel->prev_raw_counts) { + evsel->prev_raw_counts->aggr.val = 0; + evsel->prev_raw_counts->aggr.ena = 0; + evsel->prev_raw_counts->aggr.run = 0; + } +} + static int perf_evsel__alloc_stats(struct perf_evsel *evsel, bool alloc_raw) { int ncpus = perf_evsel__nr_cpus(evsel); @@ -205,6 +214,14 @@ void perf_evlist__reset_stats(struct perf_evlist *evlist) } } +void perf_evlist__reset_prev_raw_counts(struct perf_evlist *evlist) +{ + struct perf_evsel *evsel; + + evlist__for_each_entry(evlist, evsel) + perf_evsel__reset_prev_raw_counts(evsel); +} + static void zero_per_pkg(struct perf_evsel *counter) { if (counter->per_pkg_mask) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 0f9c9f6e2041..edbeb2f63e8d 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -194,6 +194,7 @@ void perf_stat__collect_metric_expr(struct perf_evlist *); int perf_evlist__alloc_stats(struct perf_evlist *evlist, bool alloc_raw); void perf_evlist__free_stats(struct perf_evlist *evlist); void perf_evlist__reset_stats(struct perf_evlist *evlist); +void perf_evlist__reset_prev_raw_counts(struct perf_evlist *evlist); int perf_stat_process_counter(struct perf_stat_config *config, struct perf_evsel *counter); -- 2.18.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 27/31] perf stat: Fix a segmentation fault when using repeat forever [not found] <20190920142542.12047-1-acme@kernel.org> 2019-09-20 14:25 ` [PATCH 26/31] perf stat: Reset previous counts on repeat with interval Arnaldo Carvalho de Melo @ 2019-09-20 14:25 ` Arnaldo Carvalho de Melo 1 sibling, 0 replies; 5+ messages in thread From: Arnaldo Carvalho de Melo @ 2019-09-20 14:25 UTC (permalink / raw) To: Ingo Molnar, Thomas Gleixner Cc: Jiri Olsa, Namhyung Kim, Clark Williams, linux-kernel, linux-perf-users, Srikar Dronamraju, Arnaldo Carvalho de Melo, Ravi Bangoria, Naveen N . Rao, stable From: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Observe a segmentation fault when 'perf stat' is asked to repeat forever with the interval option. Without fix: # perf stat -r 0 -I 5000 -e cycles -a sleep 10 # time counts unit events 5.000211692 3,13,89,82,34,157 cycles 10.000380119 1,53,98,52,22,294 cycles 10.040467280 17,16,79,265 cycles Segmentation fault This problem was only observed when we use forever option aka -r 0 and works with limited repeats. Calling print_counter with ts being set to NULL, is not a correct option when interval is set. Hence avoid print_counter(NULL,..) if interval is set. With fix: # perf stat -r 0 -I 5000 -e cycles -a sleep 10 # time counts unit events 5.019866622 3,15,14,43,08,697 cycles 10.039865756 3,15,16,31,95,261 cycles 10.059950628 1,26,05,47,158 cycles 5.009902655 3,14,52,62,33,932 cycles 10.019880228 3,14,52,22,89,154 cycles 10.030543876 66,90,18,333 cycles 5.009848281 3,14,51,98,25,437 cycles 10.029854402 3,15,14,93,04,918 cycles 5.009834177 3,14,51,95,92,316 cycles Committer notes: Did the 'git bisect' to find the cset introducing the problem to add the Fixes tag below, and at that time the problem reproduced as: (gdb) run stat -r0 -I500 sleep 1 <SNIP> Program received signal SIGSEGV, Segmentation fault. print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866 866 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, csv_sep); (gdb) bt #0 print_interval (prefix=prefix@entry=0x7fffffffc8d0 "", ts=ts@entry=0x0) at builtin-stat.c:866 #1 0x000000000041860a in print_counters (ts=ts@entry=0x0, argc=argc@entry=2, argv=argv@entry=0x7fffffffd640) at builtin-stat.c:938 #2 0x0000000000419a7f in cmd_stat (argc=2, argv=0x7fffffffd640, prefix=<optimized out>) at builtin-stat.c:1411 #3 0x000000000045c65a in run_builtin (p=p@entry=0x6291b8 <commands+216>, argc=argc@entry=5, argv=argv@entry=0x7fffffffd640) at perf.c:370 #4 0x000000000045c893 in handle_internal_command (argc=5, argv=0x7fffffffd640) at perf.c:429 #5 0x000000000045c8f1 in run_argv (argcp=argcp@entry=0x7fffffffd4ac, argv=argv@entry=0x7fffffffd4a0) at perf.c:473 #6 0x000000000045cac9 in main (argc=<optimized out>, argv=<optimized out>) at perf.c:588 (gdb) Mostly the same as just before this patch: Program received signal SIGSEGV, Segmentation fault. 0x00000000005874a7 in print_interval (config=0xa1f2a0 <stat_config>, evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964 964 sprintf(prefix, "%6lu.%09lu%s", ts->tv_sec, ts->tv_nsec, config->csv_sep); (gdb) bt #0 0x00000000005874a7 in print_interval (config=0xa1f2a0 <stat_config>, evlist=0xbc9b90, prefix=0x7fffffffd1c0 "`", ts=0x0) at util/stat-display.c:964 #1 0x0000000000588047 in perf_evlist__print_counters (evlist=0xbc9b90, config=0xa1f2a0 <stat_config>, _target=0xa1f0c0 <target>, ts=0x0, argc=2, argv=0x7fffffffd670) at util/stat-display.c:1172 #2 0x000000000045390f in print_counters (ts=0x0, argc=2, argv=0x7fffffffd670) at builtin-stat.c:656 #3 0x0000000000456bb5 in cmd_stat (argc=2, argv=0x7fffffffd670) at builtin-stat.c:1960 #4 0x00000000004dd2e0 in run_builtin (p=0xa30e00 <commands+288>, argc=5, argv=0x7fffffffd670) at perf.c:310 #5 0x00000000004dd54d in handle_internal_command (argc=5, argv=0x7fffffffd670) at perf.c:362 #6 0x00000000004dd694 in run_argv (argcp=0x7fffffffd4cc, argv=0x7fffffffd4c0) at perf.c:406 #7 0x00000000004dda11 in main (argc=5, argv=0x7fffffffd670) at perf.c:531 (gdb) Fixes: d4f63a4741a8 ("perf stat: Introduce print_counters function") Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com> Cc: stable@vger.kernel.org # v4.2+ Link: http://lore.kernel.org/lkml/20190904094738.9558-3-srikar@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> --- 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 fa4b148ecfca..60cdd383af81 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1956,7 +1956,7 @@ int cmd_stat(int argc, const char **argv) perf_evlist__reset_prev_raw_counts(evsel_list); status = run_perf_stat(argc, argv, run_idx); - if (forever && status != -1) { + if (forever && status != -1 && !interval) { print_counters(NULL, argc, argv); perf_stat__reset_stats(); } -- 2.21.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-24 6:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190920142542.12047-1-acme@kernel.org>
2019-09-20 14:25 ` [PATCH 26/31] perf stat: Reset previous counts on repeat with interval Arnaldo Carvalho de Melo
[not found] ` <20190921120623.7B67920717@mail.kernel.org>
2019-09-23 16:28 ` Srikar Dronamraju
2019-09-23 17:37 ` Arnaldo Carvalho de Melo
2019-09-24 6:17 ` Srikar Dronamraju
2019-09-20 14:25 ` [PATCH 27/31] perf stat: Fix a segmentation fault when using repeat forever Arnaldo Carvalho de Melo
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).