public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: David Ahern <david.ahern@oracle.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: Thu, 19 Feb 2015 19:28:41 +0200	[thread overview]
Message-ID: <54E61D49.9000605@intel.com> (raw)
In-Reply-To: <54E60DB5.5070509@oracle.com>

On 19/02/2015 6:22 p.m., David Ahern wrote:
> On 2/19/15 9:17 AM, Adrian Hunter wrote:
>> Yes, I am sorry it is a pain. I don't know why I didn't add a comment
>> to the code :-(. Using -1 for the pid is a workaround to avoid gratuitous
>> jump label changes. If pid=0 is used and then a system-wide trace is done
>> with Intel PT, there will be a jump label change shortly after the tracing
>> starts. That means the running code gets changed, but Intel PT decoding
>> has to walk the code to reconstruct the trace - so errors result. There
>> will always be occasional jump label changes, but this avoids one that
>> would otherwise always happen.
>
> I don't understand the response. Why can't pid == getpid() (ie., pid > 0)

IIRC pid == getpid() is the same as pid = 0

 > be used for this test? pid = -1 and pid = 0 are not needed. With pid > 0
 > cpu value does not matter so cpu = -1 can be used. Again this is just to
 > determine if the kernel supports PERF_FLAG_FD_CLOEXEC. Existence of PT
 > should not be involved here.

This is about the side-effects of opening perf events. One of the side-effects
is that some jump labels get switched. For optimization reasons, there is then
a delay before they switch back. That means that a side-effect of probing the
API is that jump label changes, that otherwise would not have happened, appear
during the trace.

This is not only about Intel PT. From an abstract point of view, it is
about minimizing the disturbance to the system under test.



  reply	other threads:[~2015-02-19 17:28 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 [this message]
2015-02-24 11:31           ` Adrian Hunter
2015-02-24 16:31             ` David Ahern
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=54E61D49.9000605@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --cc=david.ahern@oracle.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