linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
@ 2016-04-22 13:25 Lada Trimasova
  2016-04-26 10:57 ` Lada Trimasova
  2016-04-26 12:42 ` Vineet Gupta
  0 siblings, 2 replies; 6+ messages in thread
From: Lada Trimasova @ 2016-04-22 13:25 UTC (permalink / raw)
  To: linux-perf-users@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	Alexey Brodkin, linux-snps-arc@lists.infradead.org

I have a question about user-space perf handling error numbers.
The problem is that PMU interrupts are not supported in arc700
architecture and it is impossible to evaluate `perf record` command.
In our perf implementation we set PERF_PMU_CAP_NO_INTERRUPT flag so
core perf infrastructure knows we don't have interrupts.

Kernel `sys_perf_event_open` handler checks if PMU interrupts are
supported and returns ENOTSUPP (524) error code.
I'd expect that perf implementation checks the return value of syscalls
and gives the user understandable error message.
But now I see:
--------------------------------->8-----------------------------------
# perf record ls
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?
--------------------------------->8-----------------------------------

As you can see the root cause of this error message is not obvious.
CONFIG_PERF_EVENTS is selected but still there's a problem while
existing suggestion barely makes any sense.
So probably there could be a way to determine if CONFIG_PERF_EVENTS was
selected or not.

I am not sure about the correct way of solving this problem. Maybe I
should add some checks of syscalls return values and give user
a warning when not PMU interrupts are available. 
Any suggestions are appreciated.

Regards,
Lada Trimasova.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
  2016-04-22 13:25 Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT Lada Trimasova
@ 2016-04-26 10:57 ` Lada Trimasova
  2016-04-26 12:42 ` Vineet Gupta
  1 sibling, 0 replies; 6+ messages in thread
From: Lada Trimasova @ 2016-04-26 10:57 UTC (permalink / raw)
  To: linux-perf-users@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	Alexey Brodkin, linux-snps-arc@lists.infradead.org

I wonder if there are any thoughts about this question.
Please treat this as a polite reminder to take a look to this problem.

Regards,
Lada

On Fri, 2016-04-22 at 16:25 +0300, Lada Trimasova wrote:

I have a question about user-space perf handling error numbers.
The problem is that PMU interrupts are not supported in arc700
architecture and it is impossible to evaluate `perf record` command.
In our perf implementation we set PERF_PMU_CAP_NO_INTERRUPT flag so
core perf infrastructure knows we don't have interrupts.

Kernel `sys_perf_event_open` handler checks if PMU interrupts are
supported and returns ENOTSUPP (524) error code.
I'd expect that perf implementation checks the return value of syscalls
and gives the user understandable error message.
But now I see:
--------------------------------->8-----------------------------------
# perf record ls
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?
--------------------------------->8-----------------------------------

As you can see the root cause of this error message is not obvious.
CONFIG_PERF_EVENTS is selected but still there's a problem while
existing suggestion barely makes any sense.
So probably there could be a way to determine if CONFIG_PERF_EVENTS was
selected or not.

I am not sure about the correct way of solving this problem. Maybe I
should add some checks of syscalls return values and give user
a warning when not PMU interrupts are available.
Any suggestions are appreciated.

Regards,
Lada Trimasova.em

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
  2016-04-22 13:25 Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT Lada Trimasova
  2016-04-26 10:57 ` Lada Trimasova
@ 2016-04-26 12:42 ` Vineet Gupta
  2016-04-27 15:13   ` Lada Trimasova
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: Vineet Gupta @ 2016-04-26 12:42 UTC (permalink / raw)
  To: Lada Trimasova, linux-perf-users@vger.kernel.org
  Cc: peterz@infradead.org, linux-snps-arc@lists.infradead.org,
	Alexey Brodkin, linux-kernel@vger.kernel.org

On Friday 22 April 2016 06:56 PM, Lada Trimasova wrote:
> I have a question about user-space perf handling error numbers.
> The problem is that PMU interrupts are not supported in arc700
> architecture and it is impossible to evaluate `perf record` command.
> In our perf implementation we set PERF_PMU_CAP_NO_INTERRUPT flag so
> core perf infrastructure knows we don't have interrupts.
>
> Kernel `sys_perf_event_open` handler checks if PMU interrupts are
> supported and returns ENOTSUPP (524) error code.
> I'd expect that perf implementation checks the return value of syscalls
> and gives the user understandable error message.
> But now I see:
> --------------------------------->8-----------------------------------
> # perf record ls
> The sys_perf_event_open() syscall returned with 524 (Unknown error 524)
> for event (cycles:ppp).

I think what we have now is sufficient - but u seem to want a prettier failure output.

Anyhow, this print is coming from util/evsel.c: perf_evsel__open_strerror()
At the very least you want another entry in switch case for ENOTSUPP and then
check if event was sampling one (
evsel->attr.sample_period) - use that as a hint for saying sampling events not
supported.

But this will print the same even if CONFIG_PERF_EVENTS=n. To really fix this you
would want to change the error code returned by SYSCALL_DEFINE5(perf_event_open
for PERF_PMU_CAP_NO_INTERRUPT to say -EOPNOTSUPP and use the sample_period to say
this was for samplign events! However this is an ABI change and might not be
acceptable as some existing scripts etc might break.

> /bin/dmesg may provide additional information.
> No CONFIG_PERF_EVENTS=y kernel support configured?
> --------------------------------->8-----------------------------------
>
> As you can see the root cause of this error message is not obvious.
> CONFIG_PERF_EVENTS is selected but still there's a problem while
> existing suggestion barely makes any sense.
> So probably there could be a way to determine if CONFIG_PERF_EVENTS was
> selected or not.
>
> I am not sure about the correct way of solving this problem. Maybe I
> should add some checks of syscalls return values and give user
> a warning when not PMU interrupts are available. 
> Any suggestions are appreciated.
>
> Regards,
> Lada Trimasova.
> _______________________________________________
> linux-snps-arc mailing list
> linux-snps-arc@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-snps-arc

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
  2016-04-26 12:42 ` Vineet Gupta
@ 2016-04-27 15:13   ` Lada Trimasova
       [not found]   ` <1461770030.5970.8.camel__5728.3871378333$1461770054$gmane$org@synopsys.com>
  2016-05-05 13:21   ` Vineet Gupta
  2 siblings, 0 replies; 6+ messages in thread
From: Lada Trimasova @ 2016-04-27 15:13 UTC (permalink / raw)
  To: linux-perf-users@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	Alexey Brodkin, linux-snps-arc@lists.infradead.org

On Tue, 2016-04-26 at 12:42 +0000, Vineet Gupta wrote:

On Friday 22 April 2016 06:56 PM, Lada Trimasova wrote:
I think what we have now is sufficient - but u seem to want a prettier failure output.

Anyhow, this print is coming from util/evsel.c: perf_evsel__open_strerror()
At the very least you want another entry in switch case for ENOTSUPP and then
check if event was sampling one (
evsel->attr.sample_period) - use that as a hint for saying sampling events not
supported.




ENOTSUPP is not visible for user programs. So it's impossible to add this entry

to mentioned switch.

I think that there is no good way to make error message more understandable

without breaking existing api.


But this will print the same even if CONFIG_PERF_EVENTS=n. To really fix this you
would want to change the error code returned by SYSCALL_DEFINE5(perf_event_open
for PERF_PMU_CAP_NO_INTERRUPT to say -EOPNOTSUPP and use the sample_period to say
this was for samplign events! However this is an ABI change and might not be
acceptable as some existing scripts etc might break.



/bin/dmesg may provide additional information.
No CONFIG_PERF_EVENTS=y kernel support configured?
--------------------------------->8-----------------------------------

As you can see the root cause of this error message is not obvious.
CONFIG_PERF_EVENTS is selected but still there's a problem while
existing suggestion barely makes any sense.
So probably there could be a way to determine if CONFIG_PERF_EVENTS was
selected or not.

I am not sure about the correct way of solving this problem. Maybe I
should add some checks of syscalls return values and give user
a warning when not PMU interrupts are available.
Any suggestions are appreciated.

Regards,
Lada Trimasova.
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org<mailto:linux-snps-arc@lists.infradead.org>
http://lists.infradead.org/mailman/listinfo/linux-snps-arc





Regards,

Lada.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
       [not found]   ` <1461770030.5970.8.camel__5728.3871378333$1461770054$gmane$org@synopsys.com>
@ 2016-04-28  4:35     ` Vineet Gupta
  0 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2016-04-28  4:35 UTC (permalink / raw)
  To: Lada Trimasova, linux-perf-users@vger.kernel.org
  Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
	Alexey Brodkin, linux-snps-arc@lists.infradead.org

On Wednesday 27 April 2016 08:43 PM, Lada Trimasova wrote:
> On Tue, 2016-04-26 at 12:42 +0000, Vineet Gupta wrote:
> 
> On Friday 22 April 2016 06:56 PM, Lada Trimasova wrote:
> I think what we have now is sufficient - but u seem to want a prettier failure output.
> 
> Anyhow, this print is coming from util/evsel.c: perf_evsel__open_strerror()
> At the very least you want another entry in switch case for ENOTSUPP and then
> check if event was sampling one (
> evsel->attr.sample_period) - use that as a hint for saying sampling events not
> supported.
> 
> 
> 
> 
> ENOTSUPP is not visible for user programs. So it's impossible to add this entry
> 
> to mentioned switch.
> 
> I think that there is no good way to make error message more understandable
> 
> without breaking existing api.

I meant EOPNOTSUPP. Any errno value has to be visible to user programs otherwise
there is no point defining it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT
  2016-04-26 12:42 ` Vineet Gupta
  2016-04-27 15:13   ` Lada Trimasova
       [not found]   ` <1461770030.5970.8.camel__5728.3871378333$1461770054$gmane$org@synopsys.com>
@ 2016-05-05 13:21   ` Vineet Gupta
  2 siblings, 0 replies; 6+ messages in thread
From: Vineet Gupta @ 2016-05-05 13:21 UTC (permalink / raw)
  To: Vineet Gupta, Lada Trimasova, linux-perf-users@vger.kernel.org
  Cc: peterz@infradead.org, linux-snps-arc@lists.infradead.org,
	Alexey Brodkin, linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo, Vince Weaver, Will Deacon, Ingo Molnar

On Tuesday 26 April 2016 06:12 PM, Vineet Gupta wrote:
> On Friday 22 April 2016 06:56 PM, Lada Trimasova wrote:
>> I have a question about user-space perf handling error numbers.
>> The problem is that PMU interrupts are not supported in arc700
>> architecture and it is impossible to evaluate `perf record` command.
>> In our perf implementation we set PERF_PMU_CAP_NO_INTERRUPT flag so
>> core perf infrastructure knows we don't have interrupts.
>>
>> Kernel `sys_perf_event_open` handler checks if PMU interrupts are
>> supported and returns ENOTSUPP (524) error code.
>> I'd expect that perf implementation checks the return value of syscalls
>> and gives the user understandable error message.
>> But now I see:
>> --------------------------------->8-----------------------------------
>> # perf record ls
>> 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?
>> --------------------------------->8-----------------------------------

Guys, is the ABI change for returning -EOPNOTSUPP vs. -ENOTSUPP for
is_sampling_event() && (event->pmu->capabilities & PERF_PMU_CAP_NO_INTERRUPT)
acceptable ? We could use this in userspace to print pretty rather than half
cooked error msg above !

-Vineet

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-05 13:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 13:25 Misleading hint to select CONFIG_PERF_EVENTS if driver sets PERF_PMU_CAP_NO_INTERRUPT Lada Trimasova
2016-04-26 10:57 ` Lada Trimasova
2016-04-26 12:42 ` Vineet Gupta
2016-04-27 15:13   ` Lada Trimasova
     [not found]   ` <1461770030.5970.8.camel__5728.3871378333$1461770054$gmane$org@synopsys.com>
2016-04-28  4:35     ` Vineet Gupta
2016-05-05 13:21   ` Vineet Gupta

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).