lkml.org 
[lkml]   [2019]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 6/9] perf stat: Factor out open error handling
On Mon, Nov 04, 2019 at 04:25:19PM -0800, Andi Kleen wrote:

SNIP

> goto try_again;
> }
>
> - /*
> - * PPC returns ENXIO for HW counters until 2.6.37
> - * (behavior changed with commit b0a873e).
> - */
> - if (errno == EINVAL || errno == ENOSYS ||
> - errno == ENOENT || errno == EOPNOTSUPP ||
> - errno == ENXIO) {
> - if (verbose > 0)
> - ui__warning("%s event is not supported by the kernel.\n",
> - perf_evsel__name(counter));
> - counter->supported = false;
> -
> - if ((counter->leader != counter) ||
> - !(counter->leader->core.nr_members > 1))
> - continue;
> - } else if (perf_evsel__fallback(counter, errno, msg, sizeof(msg))) {
> - if (verbose > 0)
> - ui__warning("%s\n", msg);
> - goto try_again;
> - } else if (target__has_per_thread(&target) &&
> - evsel_list->core.threads &&
> - evsel_list->core.threads->err_thread != -1) {
> - /*
> - * For global --per-thread case, skip current
> - * error thread.
> - */
> - if (!thread_map__remove(evsel_list->core.threads,
> - evsel_list->core.threads->err_thread)) {
> - evsel_list->core.threads->err_thread = -1;
> - goto try_again;
> - }
> + switch (stat_handle_error(counter)) {
> + case COUNTER_FATAL:
> + return -1;
> + case COUNTER_RETRY:
> + goto try_again;
> + case COUNTER_SKIP:
> + continue;
> + default:
> + break;
> }

great, looks good, thanks

jirka

> -
> - perf_evsel__open_strerror(counter, &target,
> - errno, msg, sizeof(msg));
> - ui__error("%s\n", msg);
> -
> - if (child_pid != -1)
> - kill(child_pid, SIGTERM);
> -
> - return -1;
> }
> counter->supported = true;
>
> --
> 2.23.0
>

\
 
 \ /
  Last update: 2019-11-06 17:34    [W:0.080 / U:1.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site