From: David Ahern <dsahern@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Jiri Olsa <jolsa@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
John Stultz <john.stultz@linaro.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] perf, record: Add clockid parameter
Date: Mon, 30 Mar 2015 11:24:12 -0600 [thread overview]
Message-ID: <551986BC.3000409@gmail.com> (raw)
In-Reply-To: <20150328075549.GG27490@worktop.programming.kicks-ass.net>
On 3/28/15 1:55 AM, Peter Zijlstra wrote:
> @@ -1085,6 +1093,8 @@ static int __perf_evsel__open(struct per
> }
>
> fallback_missing_features:
> + if (perf_missing_features.clockid)
> + evsel->attr.use_clockid = 0;
> if (perf_missing_features.cloexec)
> flags &= ~(unsigned long)PERF_FLAG_FD_CLOEXEC;
> if (perf_missing_features.mmap2)
> @@ -1122,6 +1132,16 @@ static int __perf_evsel__open(struct per
> goto try_fallback;
> }
> set_rlimit = NO_CHANGE;
> +
> + /*
> + * If we succeeded but had to kill clockid, fail and
> + * have perf_evsel__open_strerror() print us a nice
> + * error.
> + */
> + if (perf_missing_features.clockid) {
> + err = -EINVAL;
> + goto out_close;
> + }
> }
> }
>
> @@ -1155,7 +1175,10 @@ static int __perf_evsel__open(struct per
> if (err != -EINVAL || cpu > 0 || thread > 0)
> goto out_close;
>
> - if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
> + if (!perf_missing_features.clockid && evsel->attr.use_clockid) {
> + perf_missing_features.clockid = true;
> + goto fallback_missing_features;
> + } else if (!perf_missing_features.cloexec && (flags & PERF_FLAG_FD_CLOEXEC)) {
> perf_missing_features.cloexec = true;
> goto fallback_missing_features;
> } else if (!perf_missing_features.mmap2 && evsel->attr.mmap2) {
...
> @@ -2158,6 +2188,12 @@ int perf_evsel__open_strerror(struct per
> "The PMU counters are busy/taken by another profiler.\n"
> "We found oprofile daemon running, please stop it and try again.");
> break;
> +
> + case EINVAL:
> + if (perf_missing_features.clockid)
> + return scnprintf(msg, size, "%s", "clockid not supported.");
> + break;
> +
> default:
> break;
> }
>
This works but the result is not always intuitive as to why it failed.
On a kernel that does not support the clock id you get:
$ perf sched record -k mono -- sleep 1
Error:
clockid not supported.
And on a kernel that supports clockid but not for NMI:
$ perf record -k realtime -a -- sleep 1
Error:
clockid not supported.
--> H/W counters so realtime is not allowed
Same message though different root causes.
next prev parent reply other threads:[~2015-03-30 17:24 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-34f439278cef7b1177f8ce24f9fc81dfc6221d3b@git.kernel.org>
2015-03-27 14:32 ` [PATCH] perf, record: Add clockid parameter Peter Zijlstra
2015-03-27 17:11 ` David Ahern
2015-03-27 17:20 ` Peter Zijlstra
2015-03-27 17:35 ` David Ahern
2015-03-27 20:15 ` Arnaldo Carvalho de Melo
2015-03-27 21:59 ` Peter Zijlstra
2015-03-27 22:37 ` Stephane Eranian
2015-03-28 7:55 ` Peter Zijlstra
2015-03-30 1:00 ` David Ahern
2015-03-30 8:24 ` Peter Zijlstra
2015-03-30 17:11 ` David Ahern
2015-03-30 9:17 ` Peter Zijlstra
2015-03-30 17:17 ` David Ahern
2015-03-30 19:32 ` Peter Zijlstra
2015-03-30 19:39 ` David Ahern
2015-03-30 17:24 ` David Ahern [this message]
2015-03-30 19:33 ` Peter Zijlstra
2015-03-30 19:41 ` David Ahern
2015-03-30 19:43 ` Stephane Eranian
2015-03-31 8:19 ` Peter Zijlstra
2015-03-31 10:46 ` [RFC][PATCH] perf tools: unify perf_event_attr printing Peter Zijlstra
2015-04-01 16:26 ` Peter Zijlstra
2015-04-01 16:52 ` Jiri Olsa
2015-04-02 9:01 ` Adrian Hunter
2015-04-02 11:59 ` Peter Zijlstra
2015-04-02 12:54 ` Adrian Hunter
2015-04-03 16:11 ` Arnaldo Carvalho de Melo
2015-04-03 16:14 ` Arnaldo Carvalho de Melo
2015-04-02 8:12 ` Ingo Molnar
2015-04-02 22:28 ` Arnaldo Carvalho de Melo
2015-04-02 9:19 ` Jiri Olsa
2015-03-30 17:33 ` [PATCH] perf, record: Add clockid parameter David Ahern
2015-03-30 19:34 ` Peter Zijlstra
2015-03-30 19:46 ` David Ahern
2015-03-27 23:07 ` Stephane Eranian
2015-03-27 16:31 ` [tip:perf/timer] perf: Add per event clockid support Stephane Eranian
2015-03-27 16:35 ` Peter Zijlstra
2015-03-27 16:52 ` Stephane Eranian
2015-03-27 16:57 ` Peter Zijlstra
2015-03-27 17:00 ` Stephane Eranian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=551986BC.3000409@gmail.com \
--to=dsahern@gmail.com \
--cc=acme@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=john.stultz@linaro.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).