Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1396883 > unrolled thread
| Started by | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| First post | 2016-05-09 11:40 +0200 |
| Last post | 2016-05-30 13:40 +0200 |
| Articles | 15 — 4 participants |
Back to article view | Back to linux.kernel
[RFC 0/2] report perf sampling failing due to PMU lacking overflow intr support Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-09 11:40 +0200
[RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-09 11:40 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vince Weaver <vincent.weaver@maine.edu> - 2016-05-09 16:00 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <vgupta@synopsys.com> - 2016-05-09 19:30 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vince Weaver <vincent.weaver@maine.edu> - 2016-05-11 05:40 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Peter Zijlstra <peterz@infradead.org> - 2016-05-11 21:40 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-12 08:30 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Peter Zijlstra <peterz@infradead.org> - 2016-05-12 08:50 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-12 09:00 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Peter Zijlstra <peterz@infradead.org> - 2016-05-12 09:30 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vince Weaver <vincent.weaver@maine.edu> - 2016-05-13 01:10 +0200
Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-13 10:40 +0200
[PATCH-REBASED 0/2] report perf sampling failing due to PMU lacking overflow intr support Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-30 13:40 +0200
[PATCH-REBASED 1/2] tools/perf: Handle EOPNOTSUPP for sampling events Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-30 13:40 +0200
[PATCH-REBASED 2/2] perf/core: change errno for sampling event not supported in hardware Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-05-30 13:40 +0200
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-09 11:40 +0200 |
| Subject | [RFC 0/2] report perf sampling failing due to PMU lacking overflow intr support |
| Message-ID | <rwPPr-2FZ-5@gated-at.bofh.it> |
Hi, A couple of minor patches to print better PMU lacking overflow intr support such as in ARC700 cores. This is an ABI change so might be controversial hence RFC. Despite triviality, I've seperated the change into 2 pacthes - for different maintainers and also kept userspace change first to keep it bisectable. Comments welcome ! Thx, -Vineet Vineet Gupta (2): tools/perf: Handle EOPNOTSUPP for sampling events perf/core: change errno for sampling event not supported in hardware kernel/events/core.c | 2 +- tools/perf/util/evsel.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) -- 2.5.0
[toc] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-09 11:40 +0200 |
| Subject | [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rwPPt-2FZ-35@gated-at.bofh.it> |
| In reply to | #1396883 |
This allows userspace to identify this case specifically from the
catch all error msg it prints currently.
This is an ABI change
Before
-------
| # perf record ls
| Error:
| The sys_perf_event_open() syscall returned with 524 (Unknown error 524)
| for event (cycles:ppp).
| /bin/dmesg may provide additional information.
| No CONFIG_PERF_EVENTS=y kernel support configured?
Now
-------
| # perf record ls
| Error:
| PMU Hardware doesn't support sampling/overflow-interrupts.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 4e2ebf6f2f1f..41c5c7122987 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8435,7 +8435,7 @@ SYSCALL_DEFINE5(perf_event_open,
if (is_sampling_event(event)) {
if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
- err = -ENOTSUPP;
+ err = -EOPNOTSUPP;
goto err_alloc;
}
}
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Vince Weaver <vincent.weaver@maine.edu> |
|---|---|
| Date | 2016-05-09 16:00 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rwTT3-6II-1@gated-at.bofh.it> |
| In reply to | #1396888 |
On Mon, 9 May 2016, Vineet Gupta wrote: > This allows userspace to identify this case specifically from the > catch all error msg it prints currently. > > This is an ABI change An ABI change which will probably break things. The original change from ENODEV to ENOTSUPP managed to break things although it took four kernel releases before anyone noticed. The usage of ENOTSUPP was my fault, though I feel like at the time I was told that ENOTSUPP is for internal kernel usage and would be converted to EOPNOTSUPP when returning an error to userspace. But now I can't find any sort of reference for that at all, except the fact that /usr/include/x86_64-linux-gnu/bits/errno.h has /* Linux has no ENOTSUP error code. */ # define ENOTSUP EOPNOTSUPP in it... but wait, that's ENOTSUP not ENOTSUPP. Blargh. Vince
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <vgupta@synopsys.com> |
|---|---|
| Date | 2016-05-09 19:30 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rwXal-1D1-73@gated-at.bofh.it> |
| In reply to | #1397072 |
On Monday 09 May 2016 07:24 PM, Vince Weaver wrote: > On Mon, 9 May 2016, Vineet Gupta wrote: > >> This allows userspace to identify this case specifically from the >> catch all error msg it prints currently. >> >> This is an ABI change > > An ABI change which will probably break things. Right thats what I feared. But hold on, I don't think we need to change the ABI to achieve what we want. Gosh why did I even take that path. Currently the errno switch case in perf_evsel__open_strerror() in doesn't handle ENOTSUPP. So how about we add that - augmented with the same sample_period !0 check to barf for lack of sampling support. Do you see anything wrong with that ? -Vineet > > The original change from ENODEV to ENOTSUPP managed to break things > although it took four kernel releases before anyone noticed. > > The usage of ENOTSUPP was my fault, though I feel like at the time I was > told that ENOTSUPP is for internal kernel usage and would be converted to > EOPNOTSUPP when returning an error to userspace. But now I > can't find any sort of reference for that at all, except the fact that > > /usr/include/x86_64-linux-gnu/bits/errno.h > > has > /* Linux has no ENOTSUP error code. */ > # define ENOTSUP EOPNOTSUPP > > in it... but wait, that's ENOTSUP not ENOTSUPP. Blargh. > > Vince >
[toc] | [prev] | [next] | [standalone]
| From | Vince Weaver <vincent.weaver@maine.edu> |
|---|---|
| Date | 2016-05-11 05:40 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxta9-8ke-5@gated-at.bofh.it> |
| In reply to | #1397222 |
On Mon, 9 May 2016, Vineet Gupta wrote: > On Monday 09 May 2016 07:24 PM, Vince Weaver wrote: > > On Mon, 9 May 2016, Vineet Gupta wrote: > > > >> This allows userspace to identify this case specifically from the > >> catch all error msg it prints currently. > >> > >> This is an ABI change > > > > An ABI change which will probably break things. > > > Right thats what I feared. But hold on, I don't think we need to change the ABI to > achieve what we want. Gosh why did I even take that path. > > Currently the errno switch case in perf_evsel__open_strerror() in doesn't handle > ENOTSUPP. So how about we add that - augmented with the same sample_period !0 > check to barf for lack of sampling support. > > Do you see anything wrong with that ? no, but it would be nice if one of the actual maintainers would chime in with an opinion. In any case if ENOTSUPP is being returned to userspace I should update the perf_event manpage to reflect that. Vince
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-05-11 21:40 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxI9b-6rJ-7@gated-at.bofh.it> |
| In reply to | #1397222 |
On Mon, May 09, 2016 at 10:53:43PM +0530, Vineet Gupta wrote: > Right thats what I feared. But hold on, I don't think we need to change the ABI to > achieve what we want. Gosh why did I even take that path. > > Currently the errno switch case in perf_evsel__open_strerror() in doesn't handle > ENOTSUPP. So how about we add that - augmented with the same sample_period !0 > check to barf for lack of sampling support. > > Do you see anything wrong with that ? Should work I think.
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-12 08:30 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxSid-7O-5@gated-at.bofh.it> |
| In reply to | #1399450 |
On Thursday 12 May 2016 01:06 AM, Peter Zijlstra wrote: > On Mon, May 09, 2016 at 10:53:43PM +0530, Vineet Gupta wrote: > >> > Right thats what I feared. But hold on, I don't think we need to change the ABI to >> > achieve what we want. Gosh why did I even take that path. >> > >> > Currently the errno switch case in perf_evsel__open_strerror() in doesn't handle >> > ENOTSUPP. So how about we add that - augmented with the same sample_period !0 >> > check to barf for lack of sampling support. >> > >> > Do you see anything wrong with that ? > > Should work I think. Tried that and doesn't even compile. Reconfirms what Vince said, ENOTSUPP is not exposed to userspace (being in include/linux and not include/uapi/linux)
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-05-12 08:50 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxSBz-im-11@gated-at.bofh.it> |
| In reply to | #1399685 |
On Thu, May 12, 2016 at 11:58:43AM +0530, Vineet Gupta wrote: > On Thursday 12 May 2016 01:06 AM, Peter Zijlstra wrote: > > On Mon, May 09, 2016 at 10:53:43PM +0530, Vineet Gupta wrote: > > > >> > Right thats what I feared. But hold on, I don't think we need to change the ABI to > >> > achieve what we want. Gosh why did I even take that path. > >> > > >> > Currently the errno switch case in perf_evsel__open_strerror() in doesn't handle > >> > ENOTSUPP. So how about we add that - augmented with the same sample_period !0 > >> > check to barf for lack of sampling support. > >> > > >> > Do you see anything wrong with that ? > > > > Should work I think. > > Tried that and doesn't even compile. Reconfirms what Vince said, ENOTSUPP is not > exposed to userspace (being in include/linux and not include/uapi/linux) Durr, so what does userspace see?
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-12 09:00 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxSLg-mB-17@gated-at.bofh.it> |
| In reply to | #1399691 |
On Thursday 12 May 2016 12:12 PM, Peter Zijlstra wrote: >> Tried that and doesn't even compile. Reconfirms what Vince said, ENOTSUPP is not >> > exposed to userspace (being in include/linux and not include/uapi/linux) > Durr, so what does userspace see? It sees the "value" of ENOTSUPP, i.e. 524 but there is no symbolic reference to it :-)
[toc] | [prev] | [next] | [standalone]
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Date | 2016-05-12 09:30 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rxTeh-WJ-5@gated-at.bofh.it> |
| In reply to | #1399696 |
On Thu, May 12, 2016 at 12:24:25PM +0530, Vineet Gupta wrote: > On Thursday 12 May 2016 12:12 PM, Peter Zijlstra wrote: > >> Tried that and doesn't even compile. Reconfirms what Vince said, ENOTSUPP is not > >> > exposed to userspace (being in include/linux and not include/uapi/linux) > > Durr, so what does userspace see? > > It sees the "value" of ENOTSUPP, i.e. 524 but there is no symbolic reference to it :-) Ah.. which might be a hint that nobody is actually explicitly testing for this and we might just get away with changing the ABI. Vince, what say you; shall we try and get away with it? ;-)
[toc] | [prev] | [next] | [standalone]
| From | Vince Weaver <vincent.weaver@maine.edu> |
|---|---|
| Date | 2016-05-13 01:10 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <ry7TX-7Gm-5@gated-at.bofh.it> |
| In reply to | #1399714 |
On Thu, 12 May 2016, Peter Zijlstra wrote: > Ah.. which might be a hint that nobody is actually explicitly testing > for this and we might just get away with changing the ABI. > > Vince, what say you; shall we try and get away with it? ;-) It's probably worth trying. The only other time anyone else noticed was in this thread https://lkml.org/lkml/2015/6/11/136 and I think the conclusion at the end of that was also that it's probably worth changing. Vince
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-13 10:40 +0200 |
| Subject | Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rygNA-8e3-13@gated-at.bofh.it> |
| In reply to | #1400412 |
On Friday 13 May 2016 04:34 AM, Vince Weaver wrote: > On Thu, 12 May 2016, Peter Zijlstra wrote: > >> Ah.. which might be a hint that nobody is actually explicitly testing >> for this and we might just get away with changing the ABI. >> >> Vince, what say you; shall we try and get away with it? ;-) > > It's probably worth trying. > > The only other time anyone else noticed was in this thread > https://lkml.org/lkml/2015/6/11/136 > and I think the conclusion at the end of that was also that it's probably > worth changing. I presume that the RFC patches I posted are fine or do we want any changes.
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-30 13:40 +0200 |
| Subject | [PATCH-REBASED 0/2] report perf sampling failing due to PMU lacking overflow intr support |
| Message-ID | <rEtI5-3A2-3@gated-at.bofh.it> |
| In reply to | #1400412 |
Hi, This is a repost of RFC [1], rebased on 4.7-rc1, to print pretty PMU lacking overflow interrupt support if user tries perf sampling. At the time of RFC review, both PeterZ and Vince seemed convinced to go ahead with this patch despite the ABI change [2]. Thx, -Vineet [1] http://lists.infradead.org/pipermail/linux-snps-arc/2016-May/001014.html [2] http://lists.infradead.org/pipermail/linux-snps-arc/2016-May/001032.html Vineet Gupta (2): tools/perf: Handle EOPNOTSUPP for sampling events perf/core: change errno for sampling event not supported in hardware kernel/events/core.c | 2 +- tools/perf/util/evsel.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-30 13:40 +0200 |
| Subject | [PATCH-REBASED 1/2] tools/perf: Handle EOPNOTSUPP for sampling events |
| Message-ID | <rEtI5-3A2-15@gated-at.bofh.it> |
| In reply to | #1408996 |
This allows (with next change to perf core) for calling out in userspace the exact reason for perf record failing when PMU doesn't support overflow interrupts Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- tools/perf/util/evsel.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 5d7037ef7d3b..1578e67c7357 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -2372,6 +2372,13 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target, "No such device - did you specify an out-of-range profile CPU?"); break; case EOPNOTSUPP: + /* + * Needs to be tested ahead of precise_ip check as + * that seems to be true for this case as well + */ + if (evsel->attr.sample_period != 0) + return scnprintf(msg, size, "%s", + "PMU Hardware doesn't support sampling/overflow-interrupts."); if (evsel->attr.precise_ip) return scnprintf(msg, size, "%s", "\'precise\' request may not be supported. Try removing 'p' modifier."); -- 2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Vineet Gupta <Vineet.Gupta1@synopsys.com> |
|---|---|
| Date | 2016-05-30 13:40 +0200 |
| Subject | [PATCH-REBASED 2/2] perf/core: change errno for sampling event not supported in hardware |
| Message-ID | <rEtI5-3A2-21@gated-at.bofh.it> |
| In reply to | #1408996 |
This allows userspace to identify this case specifically from the
catch all error msg it prints currently.
This is an ABI change
Before
-------
| # perf record ls
| Error:
| The sys_perf_event_open() syscall returned with 524 (Unknown error 524)
| for event (cycles:ppp).
| /bin/dmesg may provide additional information.
| No CONFIG_PERF_EVENTS=y kernel support configured?
Now
-------
| # perf record ls
| Error:
| PMU Hardware doesn't support sampling/overflow-interrupts.
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
---
kernel/events/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 274450efea90..a156ec0cb420 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -9271,7 +9271,7 @@ SYSCALL_DEFINE5(perf_event_open,
if (is_sampling_event(event)) {
if (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT) {
- err = -ENOTSUPP;
+ err = -EOPNOTSUPP;
goto err_alloc;
}
}
--
2.5.0
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web