From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753233AbdFUQvi (ORCPT ); Wed, 21 Jun 2017 12:51:38 -0400 Received: from terminus.zytor.com ([65.50.211.136]:37321 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752546AbdFUQvg (ORCPT ); Wed, 21 Jun 2017 12:51:36 -0400 Date: Wed, 21 Jun 2017 09:46:02 -0700 From: tip-bot for Hendrik Brueckner Message-ID: Cc: brueckner@linux.vnet.ibm.com, bjhoupu@linux.vnet.ibm.com, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, torvalds@linux-foundation.org, tmricht@linux.vnet.ibm.com, peterz@infradead.org, tglx@linutronix.de Reply-To: alexander.shishkin@linux.intel.com, tmricht@linux.vnet.ibm.com, peterz@infradead.org, torvalds@linux-foundation.org, tglx@linutronix.de, bjhoupu@linux.vnet.ibm.com, brueckner@linux.vnet.ibm.com, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <1497954399-6355-1-git-send-email-brueckner@linux.vnet.ibm.com> References: <1497954399-6355-1-git-send-email-brueckner@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf/aux: Correct return code of rb_alloc_aux() if !has_aux(ev) Git-Commit-ID: 8a1898db51a3390241cd5fae267dc8aaa9db0f8b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8a1898db51a3390241cd5fae267dc8aaa9db0f8b Gitweb: http://git.kernel.org/tip/8a1898db51a3390241cd5fae267dc8aaa9db0f8b Author: Hendrik Brueckner AuthorDate: Tue, 20 Jun 2017 12:26:39 +0200 Committer: Ingo Molnar 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 Acked-by: Alexander Shishkin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Pu Hou Cc: Thomas Gleixner Cc: Thomas-Mich Richter 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 --- 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) { /*