Skip to content

Commit

Permalink
perf trace: Fix error reporting for evsel pgfault constructor
Browse files Browse the repository at this point in the history
In that case the only failure possible is not to have enough memory, as
we are just creating the evsels, not trying to access any system
facility such as debugfs files or syscalls.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-7k6asvfhiwiu2zs6o2oknchk@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed Jan 22, 2015
1 parent 801c67b commit 5ed08da
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -2063,18 +2063,12 @@ static int trace__run(struct trace *trace, int argc, const char **argv)

if ((trace->trace_pgfaults & TRACE_PFMAJ) &&
perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MAJ)) {
/*
* FIXME: This one needs better error handling, as by now we
* already checked that debugfs is mounted and that we have access to it,
* so probably the case is that something is busted wrt this specific
* software event, ditto for the next gotos to out_error_tp...
*/
goto out_error_tp;
goto out_error_mem;
}

if ((trace->trace_pgfaults & TRACE_PFMIN) &&
perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MIN))
goto out_error_tp;
goto out_error_mem;

if (trace->sched &&
perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime",
Expand Down Expand Up @@ -2225,6 +2219,9 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
fprintf(trace->output, "%s\n", errbuf);
goto out_delete_evlist;
}
out_error_mem:
fprintf(trace->output, "Not enough memory to run!\n");
goto out_delete_evlist;
}

static int trace__replay(struct trace *trace)
Expand Down

0 comments on commit 5ed08da

Please sign in to comment.