lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 14 Jan 2014 08:36:29 -0800 From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com> To: linux-tip-commits@...r.kernel.org Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, paulus@...ba.org, acme@...hat.com, hpa@...or.com, mingo@...nel.org, peterz@...radead.org, efault@....de, namhyung@...nel.org, jolsa@...hat.com, fweisbec@...il.com, dsahern@...il.com, adrian.hunter@...el.com, tglx@...utronix.de Subject: [tip:perf/core] perf stat: Don' t show counter information when workload fails Commit-ID: 6af206fd911c825b83dd4efb2534a3a34ce77072 Gitweb: http://git.kernel.org/tip/6af206fd911c825b83dd4efb2534a3a34ce77072 Author: Arnaldo Carvalho de Melo <acme@...hat.com> AuthorDate: Sat, 28 Dec 2013 15:45:08 -0300 Committer: Arnaldo Carvalho de Melo <acme@...hat.com> CommitDate: Mon, 13 Jan 2014 10:06:21 -0300 perf stat: Don't show counter information when workload fails When starting a workload 'stat' wasn't using prepare_workload evlist method's signal based exec() error reporting mechanism. Use it so that the we don't report 'not counted' counters. Before: [acme@zoo linux]$ perf stat dfadsfa dfadsfa: No such file or directory Performance counter stats for 'dfadsfa': <not counted> task-clock <not counted> context-switches <not counted> cpu-migrations <not counted> page-faults <not counted> cycles <not counted> stalled-cycles-frontend <not supported> stalled-cycles-backend <not counted> instructions <not counted> branches <not counted> branch-misses 0.001831462 seconds time elapsed [acme@zoo linux]$ After: [acme@zoo linux]$ perf stat dfadsfa dfadsfa: No such file or directory [acme@zoo linux]$ Reported-by: David Ahern <dsahern@...il.com> Cc: Adrian Hunter <adrian.hunter@...el.com> Cc: David Ahern <dsahern@...il.com> Cc: Frederic Weisbecker <fweisbec@...il.com> Cc: Jiri Olsa <jolsa@...hat.com> Cc: Mike Galbraith <efault@....de> Cc: Namhyung Kim <namhyung@...nel.org> Cc: Paul Mackerras <paulus@...ba.org> Cc: Peter Zijlstra <peterz@...radead.org> Cc: Stephane Eranian <eranian@...gle.com> Link: http://lkml.kernel.org/n/tip-5yui3bv7e3hitxucnjsn6z8q@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com> --- tools/perf/builtin-stat.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 106a5e5..1c76c7a 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -509,6 +509,18 @@ static void handle_initial_delay(void) } } +static volatile bool workload_exec_failed; + +/* + * perf_evlist__prepare_workload will send a SIGUSR1 + * if the fork fails, since we asked by setting its + * want_signal to true. + */ +static void workload_exec_failed_signal(int signo __maybe_unused) +{ + workload_exec_failed = true; +} + static int __run_perf_stat(int argc, const char **argv) { char msg[512]; @@ -529,7 +541,7 @@ static int __run_perf_stat(int argc, const char **argv) if (forks) { if (perf_evlist__prepare_workload(evsel_list, &target, argv, - false, false) < 0) { + false, true) < 0) { perror("failed to prepare workload"); return -1; } @@ -584,6 +596,14 @@ static int __run_perf_stat(int argc, const char **argv) clock_gettime(CLOCK_MONOTONIC, &ref_time); if (forks) { + /* + * perf_evlist__prepare_workload will, after we call + * perf_evlist__start_Workload, send a SIGUSR1 if the exec call + * fails, that we will catch in workload_signal to flip + * workload_exec_failed. + */ + signal(SIGUSR1, workload_exec_failed_signal); + perf_evlist__start_workload(evsel_list); handle_initial_delay(); @@ -594,6 +614,10 @@ static int __run_perf_stat(int argc, const char **argv) } } wait(&status); + + if (workload_exec_failed) + return -1; + if (WIFSIGNALED(status)) psignal(WTERMSIG(status), argv[0]); } else { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists