Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396883 > unrolled thread

[RFC 0/2] report perf sampling failing due to PMU lacking overflow intr support

Started byVineet Gupta <Vineet.Gupta1@synopsys.com>
First post2016-05-09 11:40 +0200
Last post2016-05-12 09:30 +0200
Articles 10 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1396883 — [RFC 0/2] report perf sampling failing due to PMU lacking overflow intr support

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2016-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]


#1396888 — [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2016-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]


#1397072 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVince Weaver <vincent.weaver@maine.edu>
Date2016-05-09 16:00 +0200
SubjectRe: [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]


#1397222 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVineet Gupta <vgupta@synopsys.com>
Date2016-05-09 19:30 +0200
SubjectRe: [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]


#1398662 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVince Weaver <vincent.weaver@maine.edu>
Date2016-05-11 05:40 +0200
SubjectRe: [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]


#1399450 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromPeter Zijlstra <peterz@infradead.org>
Date2016-05-11 21:40 +0200
SubjectRe: [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]


#1399685 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2016-05-12 08:30 +0200
SubjectRe: [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]


#1399691 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromPeter Zijlstra <peterz@infradead.org>
Date2016-05-12 08:50 +0200
SubjectRe: [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]


#1399696 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2016-05-12 09:00 +0200
SubjectRe: [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]


#1399714 — Re: [RFC 2/2] perf/core: change errno for sampling event not supported in hardware

FromPeter Zijlstra <peterz@infradead.org>
Date2016-05-12 09:30 +0200
SubjectRe: [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] | [standalone]


Back to top | Article view | linux.kernel


csiph-web