public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <david.ahern@oracle.com>
To: Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>,
	acme@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag
Date: Tue, 24 Feb 2015 09:31:28 -0700	[thread overview]
Message-ID: <54ECA760.50407@oracle.com> (raw)
In-Reply-To: <54EC610C.8000403@intel.com>

On 2/24/15 4:31 AM, Adrian Hunter wrote:
> How about this:
>
> From: Adrian Hunter <adrian.hunter@intel.com>
> 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 <david.ahern@oracle.com>
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>   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 <david.ahern@oracle.com>


  reply	other threads:[~2015-02-24 16:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19  0:01 [PATCH] perf: Fix probing for PERF_FLAG_FD_CLOEXEC flag David Ahern
2015-02-19  7:06 ` Adrian Hunter
2015-02-19 14:55   ` David Ahern
2015-02-19 16:17     ` Adrian Hunter
2015-02-19 16:22       ` David Ahern
2015-02-19 17:28         ` Adrian Hunter
2015-02-24 11:31           ` Adrian Hunter
2015-02-24 16:31             ` David Ahern [this message]
2015-03-01 16:50             ` [tip:perf/urgent] perf tools: " tip-bot for Adrian Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54ECA760.50407@oracle.com \
    --to=david.ahern@oracle.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox