mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>,
	John Stultz <john.stultz@linaro.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Pawel Moll <pawel.moll@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 0/2] perf/x86: Add ability to sample TSC
Date: Thu, 19 Feb 2015 16:05:43 +0100	[thread overview]
Message-ID: <20150219150543.GE21418@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <54E5F581.9000205@intel.com>

On Thu, Feb 19, 2015 at 04:38:57PM +0200, Adrian Hunter wrote:
> On 19/02/15 15:50, Peter Zijlstra wrote:
> > On Thu, Feb 19, 2015 at 02:11:08PM +0200, Adrian Hunter wrote:
> >> Hi
> >>
> >> With the advent of switching perf_clock to CLOCK_MONOTONIC,
> >> it will not be possible to convert perf_clock directly to/from
> >> TSC. So add the ability to sample TSC instead.
> > 
> > Well, you can, mostly. MONOTONIC is only affected by NTP slew rate
> > changes, not offset changes.
> 
> man page says is also subject to adjtime(3)

which is slew adjustment; read the adjtime manpage :-)

> > And NTP limits the slew rate to 500 PPM, so even if you would get a
> 
> Assuming it is not broken.

NTP people are a cautious crowd, sure they get it wrong just like the
rest of us, but mostly it needs to work.

> > slew change and then not update the userpage data for a second you'd be
> > maximally off by 0.0005 seconds.
> 
> That could still be enough to break the decoder. It will certainly
> misrepresent the order of events, which is a big loss of information.

What decoder? perf report is already subject to much larger shifts in
time if you run it on say a core2 machine.

> > And that is way below what the current perf clock guarantees on funny
> > hardware.
> > 
> > If you're really worried about this; we could maybe get John and Thomas
> > to allow us a callback on every slew change so we can update the
> > userpage data ASAP, much reducing the max error.
> > 
> > Say it takes a 10e5 cycles to update your userpage, then you're never
> > further off than 50 cycles, which is below your ART multiplier.
> 
> You still need to wake up user space to read the userpage.

Uhm what? Userspace is already awake.

> > Does that really matter? Also, if you have a stable crystal, the slew
> > rate change should be minimal and infrequent, never getting you close to
> > these numbers.
> > 
> > So no, I'm not convinced we need this.
> 
> Adding TSC to the sample is a lot simpler and more accurate.

Finding multiple samples and interpolating between them is much simpler
than reading tsc and doing the mult, shift and offset addition?

I suspect you're talking about something else entirely; your changelogs
are inadequate for they tell ntohing of your usecase and have me
guessing. Don't do that.

  reply	other threads:[~2015-02-19 15:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 12:11 Adrian Hunter
2015-02-19 12:11 ` [PATCH 1/2] perf: Sample additional clock value Adrian Hunter
2015-02-19 12:11 ` [PATCH 2/2] perf/x86: Provide TSC for PERF_SAMPLE_CLOCK_ARCH Adrian Hunter
2015-02-19 13:50 ` [PATCH 0/2] perf/x86: Add ability to sample TSC Peter Zijlstra
2015-02-19 14:38   ` Adrian Hunter
2015-02-19 15:05     ` Peter Zijlstra [this message]
2015-02-19 15:56       ` Adrian Hunter
2015-02-19 19:13         ` Ingo Molnar
2015-02-19 17:41     ` Andi Kleen
2015-02-19 17:24 ` John Stultz
2015-02-19 17:40   ` Adrian Hunter
2015-02-19 17:50     ` John Stultz
2015-02-19 17:58       ` Pawel Moll
2015-02-19 18:01         ` Pawel Moll

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=20150219150543.GE21418@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=john.stultz@linaro.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@gmail.com \
    --cc=paulus@samba.org \
    --cc=pawel.moll@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

Powered by JetHome