public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Paul Mackerras <paulus@samba.org>
Subject: Re: perf_counter: request for three more sample data options
Date: Fri, 03 Apr 2009 09:51:17 +0200	[thread overview]
Message-ID: <1238745077.798.17.camel@twins> (raw)
In-Reply-To: <49D5B9E7.1020400@linux.vnet.ibm.com>

On Fri, 2009-04-03 at 00:25 -0700, Corey Ashford wrote:

> >> I am guessing the only difficult thing here would be obtaining the 
> >> current time from an IRQ, especially NMI handler.  Is this difficult?
> > 
> > Yes, quite :-) I'll have to see what we can do there -- we could do a
> > best effort thing with little to no guarantees I think.
> > 
> 
> Best effort would be fine, I think.  I would assume that means that 
> 99.9% of the time, you'll get a correct timestamp, and the rest are 
> rubbish?  Or would there be a way to detect when you're not able to give 
> a correct timestamp and in that case replace the timestamp field with a 
> special sentinel, like all hex f's?

What I was thinking of was re-using some of the cpu_clock()
infrastructure. That provides us with a jiffy based GTOD sample,
cpu_clock() then uses TSC and a few filters to compute a current
timestamp.

I was thinking about cutting back those filters and thus trusting the
TSC more -- which on x86 can do any random odd thing. So provided the
TSC is not doing funny the results will be ok-ish.

This does mean however, that its not possible to know when its gone bad.

Also, cpu_clock() can only provide monotonicity per-cpu, if a value read
on one cpu is compared to a value read on another cpu, there can be a
drift of at most 1-2 jiffies.

Anyway, I'll prod some at this and see how much of cpu_clock() we can
get working in NMI context -- currently it just bails and returns the
last value computed.

The question to Paul is, does the powerpc sched_clock() call work in NMI
-- or hard irq disable -- context?


  reply	other threads:[~2009-04-03  7:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03  1:46 perf_counter: request for three more sample data options Corey Ashford
2009-04-03  7:01 ` Peter Zijlstra
2009-04-03  7:25   ` Corey Ashford
2009-04-03  7:51     ` Peter Zijlstra [this message]
2009-04-03  8:51       ` Paul Mackerras
2009-04-03 16:38         ` Robert Richter
2009-04-03 16:41           ` Ingo Molnar
2009-04-03 16:59             ` Peter Zijlstra
2009-04-03 17:05               ` Ingo Molnar
2009-04-03 16:32       ` Ingo Molnar

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=1238745077.798.17.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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