Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753322AbbBXQbf (ORCPT ); Tue, 24 Feb 2015 11:31:35 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:37572 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960AbbBXQbd (ORCPT ); Tue, 24 Feb 2015 11:31:33 -0500 Message-ID: <54ECA760.50407@oracle.com> Date: Tue, 24 Feb 2015 09:31:28 -0700 From: David Ahern User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Adrian Hunter , David Ahern , acme@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag References: <1424304072-91955-1-git-send-email-david.ahern@oracle.com> <54E58B64.9010902@intel.com> <54E5F963.50200@gmail.com> <54E60CA0.6020001@intel.com> <54E60DB5.5070509@oracle.com> <54E61D49.9000605@intel.com> <54EC610C.8000403@intel.com> In-Reply-To: <54EC610C.8000403@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1831 Lines: 50 On 2/24/15 4:31 AM, Adrian Hunter wrote: > How about this: > > From: Adrian Hunter > Date: Tue, 24 Feb 2015 13:20:59 +0200 > Subject: [PATCH] perf tools: Fix probing for PERF_FLAG_FD_CLOEXEC flag > > Commit f6edb53c4993ffe92ce521fb449d1c146cea6ec2 converted the probe to > a CPU wide event first (pid == -1). For kernels that do not support > the PERF_FLAG_FD_CLOEXEC flag the probe fails with EINVAL. Since this > errno is not handled pid is not reset to 0 and the subsequent use of > pid = -1 as an argument brings in an additional failure path if > perf_event_paranoid > 0: > > $ perf record -- sleep 1 > perf_event_open(..., 0) failed unexpectedly with error 13 (Permission denied) > [ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 0.007 MB /tmp/perf.data (11 samples) ] This part of the commit message can be removed: > Since this function only needs to get past this check in kernel/events/core.c: > > /* for future expandability... */ > if (flags & ~PERF_FLAG_ALL) > return -EINVAL; --- > > Also, ensure the fd of the confirmation check is closed and comment > why pid = -1 is used. > > Needs to go to 3.18 stable tree as well. > > Based-on-patch-by: David Ahern > Signed-off-by: Adrian Hunter > --- > tools/perf/util/cloexec.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/tools/perf/util/cloexec.c b/tools/perf/util/cloexec.c Acked-by: David Ahern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/