]> git.karo-electronics.de Git - karo-tx-linux.git/commit
perf/aux: Correct return code of rb_alloc_aux() if !has_aux(ev)
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tue, 20 Jun 2017 10:26:39 +0000 (12:26 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 21 Jun 2017 09:58:30 +0000 (11:58 +0200)
commit8a1898db51a3390241cd5fae267dc8aaa9db0f8b
treeaf5992171da843c26f3a072e1fab03b261adf9fb
parent9705596d08ac87c18aee32cc97f2783b7d14624e
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