* [PATCH] kernel/perf: correct return code of rb_alloc_aux() if !has_aux(ev)
@ 2017-06-20 10:26 Hendrik Brueckner
2017-06-20 12:26 ` Alexander Shishkin
2017-06-21 16:46 ` [tip:perf/urgent] perf/aux: Correct " tip-bot for Hendrik Brueckner
0 siblings, 2 replies; 3+ messages in thread
From: Hendrik Brueckner @ 2017-06-20 10:26 UTC (permalink / raw)
To: peterz, mingo, acme, alexander.shishkin
Cc: linux-kernel, linux-s390, Pu Hou, Thomas-Mich Richter
If the event for which an AUX area is about to be allocated, does
not support setting up an AUX area, rb_alloc_aux() return -ENOTSUPP.
This error condition is being returned unfiltered to the user space,
and, for example, the perf tools fails with:
failed to mmap with 524 (INTERNAL ERROR: strerror_r(524, 0x3fff497a1c8, 512)=22)
This error can be easily seen with "perf record -m 128,256 -e cpu-clock".
The 524 error code maps to -ENOTSUPP (in rb_alloc_aux()). The -ENOTSUPP
error code shall be only used within the kernel. So the correct error
code would then be -EOPNOTSUPP.
With this commit, the perf tool then reports:
failed to mmap with 95 (Operation not supported)
which is more clear.
Cc: Pu Hou <bjhoupu@linux.vnet.ibm.com>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
---
kernel/events/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 2831480..ee97196 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -580,7 +580,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event,
int ret = -ENOMEM, max_order = 0;
if (!has_aux(event))
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
/*
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] kernel/perf: correct return code of rb_alloc_aux() if !has_aux(ev)
2017-06-20 10:26 [PATCH] kernel/perf: correct return code of rb_alloc_aux() if !has_aux(ev) Hendrik Brueckner
@ 2017-06-20 12:26 ` Alexander Shishkin
2017-06-21 16:46 ` [tip:perf/urgent] perf/aux: Correct " tip-bot for Hendrik Brueckner
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shishkin @ 2017-06-20 12:26 UTC (permalink / raw)
To: Hendrik Brueckner, peterz, mingo, acme
Cc: linux-kernel, linux-s390, Pu Hou, Thomas-Mich Richter
Hendrik Brueckner <brueckner@linux.vnet.ibm.com> writes:
> If the event for which an AUX area is about to be allocated, does
> not support setting up an AUX area, rb_alloc_aux() return -ENOTSUPP.
>
> This error condition is being returned unfiltered to the user space,
> and, for example, the perf tools fails with:
>
> failed to mmap with 524 (INTERNAL ERROR: strerror_r(524, 0x3fff497a1c8, 512)=22)
>
> This error can be easily seen with "perf record -m 128,256 -e cpu-clock".
>
> The 524 error code maps to -ENOTSUPP (in rb_alloc_aux()). The -ENOTSUPP
> error code shall be only used within the kernel. So the correct error
> code would then be -EOPNOTSUPP.
>
> With this commit, the perf tool then reports:
>
> failed to mmap with 95 (Operation not supported)
>
> which is more clear.
Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Curious as to why does the tool allow this.
Regards,
--
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] perf/aux: Correct return code of rb_alloc_aux() if !has_aux(ev)
2017-06-20 10:26 [PATCH] kernel/perf: correct return code of rb_alloc_aux() if !has_aux(ev) Hendrik Brueckner
2017-06-20 12:26 ` Alexander Shishkin
@ 2017-06-21 16:46 ` tip-bot for Hendrik Brueckner
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Hendrik Brueckner @ 2017-06-21 16:46 UTC (permalink / raw)
To: linux-tip-commits
Cc: brueckner, bjhoupu, mingo, hpa, linux-kernel, alexander.shishkin,
torvalds, tmricht, peterz, tglx
Commit-ID: 8a1898db51a3390241cd5fae267dc8aaa9db0f8b
Gitweb: http://git.kernel.org/tip/8a1898db51a3390241cd5fae267dc8aaa9db0f8b
Author: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
AuthorDate: Tue, 20 Jun 2017 12:26:39 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 21 Jun 2017 11:58:30 +0200
perf/aux: Correct return code of rb_alloc_aux() if !has_aux(ev)
If the event for which an AUX area is about to be allocated, does
not support setting up an AUX area, rb_alloc_aux() return -ENOTSUPP.
This error condition is being returned unfiltered to the user space,
and, for example, the perf tools fails with:
failed to mmap with 524 (INTERNAL ERROR: strerror_r(524, 0x3fff497a1c8, 512)=22)
This error can be easily seen with "perf record -m 128,256 -e cpu-clock".
The 524 error code maps to -ENOTSUPP (in rb_alloc_aux()). The -ENOTSUPP
error code shall be only used within the kernel. So the correct error
code would then be -EOPNOTSUPP.
With this commit, the perf tool then reports:
failed to mmap with 95 (Operation not supported)
which is more clear.
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Acked-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pu Hou <bjhoupu@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: acme@kernel.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/1497954399-6355-1-git-send-email-brueckner@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/events/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 2831480..ee97196 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -580,7 +580,7 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event,
int ret = -ENOMEM, max_order = 0;
if (!has_aux(event))
- return -ENOTSUPP;
+ return -EOPNOTSUPP;
if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) {
/*
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-21 16:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-20 10:26 [PATCH] kernel/perf: correct return code of rb_alloc_aux() if !has_aux(ev) Hendrik Brueckner
2017-06-20 12:26 ` Alexander Shishkin
2017-06-21 16:46 ` [tip:perf/urgent] perf/aux: Correct " tip-bot for Hendrik Brueckner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox