mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Christoph Lameter <clameter@sgi.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	tim@physik3.uni-rostock.de, george anzinger <george@mvista.com>,
	albert@users.sourceforge.net, Ulrich.Windl@rz.uni-regensburg.de,
	Len Brown <len.brown@intel.com>,
	linux@dominikbrodowski.de, David Mosberger <davidm@hpl.hp.com>,
	Andi Kleen <ak@suse.de>,
	paulus@samba.org, schwidefsky@de.ibm.com,
	keith maanthey <kmannth@us.ibm.com>, greg kh <greg@kroah.com>,
	Patricia Gaughen <gone@us.ibm.com>,
	Chris McDermott <lcm@us.ibm.com>, Max <amax@us.ibm.com>,
	mahuja@us.ibm.com
Subject: Re: [RFC] New timeofday proposal (v.A1)
Date: Wed, 08 Dec 2004 11:11:06 -0800	[thread overview]
Message-ID: <1102533066.1281.81.camel@cog.beaverton.ibm.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0412081009540.27324@schroedinger.engr.sgi.com>

On Wed, 2004-12-08 at 10:25, Christoph Lameter wrote:
> On Tue, 7 Dec 2004, john stultz wrote:
> 
> > Features of this design:
> > ========================
> 
> > o Consolidates a large amount of code:
> > 	Allows for shared times source implementations, such as: i386, x86-64
> > and ia64 all use HPET, i386 and x86-64 both have ACPI PM timers, and
> > i386 and ia64 both have cyclone counters. Time sources are just drivers!
> 
> What I would to see also included here is to provide a clean posix
> interface to these drivers. IMHO the current char interfaces to clock
> drivers should be removed. Look at SGI's mmtimer implementation in
> 2.6.10-rc3. We have modified the posix interface to allow clock drivers to
> export their timer values via CLOCK_SGI_CYCLE and we are also
> now able to schedule hardware interrupts via timer_* posix functions
> utilizing CLOCK_SGI_CYCLE that are then delivered as signals to an
> application. Timer chips usually include time sources as well as the
> ability to generate periodic or single shot
> interrupts. There needs to be some way for clock drivers to cleanly
> interface with these. The API may be the posix subsystem but I do not
> like the quality of the code nor the current API for the clock drivers.

I'm not too familiar with the posix interfaces. I've been focused with
in-kernel uses at the moment. I'll try to take a look at the mmtimer
bits and see if I can better grasp your suggestion.

> The API for user space to clocks already exists through the posix
> standard. I would suggest to work with that standard for a way to deal
> with clocks under Linux.
> 
> > Brief Psudo-code to illustrate the design:
> > ==========================================
> >
> > monotonic_clock()
> > 	now = timesource_read();	/* read the timesource */
> > 	ns = cyc2ns(now - offset_base);	/* calculate nsecs since last hook */
> > 	ntp_ns = ntp_scale(ns);		/* apply ntp scaling */
> 
> These are not really functions right? timesource_read can be a direct
> memory read and the cyc2ns and ntp_scale can be reduced to some scaling
> factor?

Yep, timesource_read() and cyc2ns are static inlines which call the
timesource read function, or just read the MMIO'ed address depending on
the timesource type.


> > Points I'm glossing over for now:
> > ====================================================
> >
> > o ntp_scale(ns):  scales ns by NTP scaling factor
> > 	- see ntp.c for details
> > 	- costly, but correct.
> 
> Please do not call this function from monotonic_clock but provide some
> sort of scaling factor that is adjusted from time to time.

You're going to have to expand on this. I had considered only NTP
scaling the wall time, but for consistency it made more sense to me that
we also apply NTP scaling to the monotonic clock. This avoids different
notions of nanoseconds, one being the inaccurate unajusted system
nanoseconds and the other being the accurately ntp scaled wall time
nanoseconds. Trying to keep things sane.


> > o Some arches (arm, for example) do not have high res timing hardware
> > 	- In this case we can have a "jiffies" timesource
> > 		- cyc2ns(x) =  x*(NSEC_PER_SEC/HZ)
> > 		- doesn't work for tickless systems
> 
> In that case maybe the "ticks" are the timesource and not really tick
> processing per se.

If I understand you, yes. In this case the timer interrupt counter
(jiffies) is used as a free running counter. 

> There could be a separation between "increment counter" and tick processing.

Could you expand on this?

thanks for the review!
-john


  reply	other threads:[~2004-12-08 19:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-08  1:55 john stultz
2004-12-08  1:56 ` [RFC] new timeofday core subsystem (v.A1) john stultz
2004-12-08  1:57   ` [RFC] new timeofday arch specific hooks (v.A1) john stultz
2004-12-08  1:58     ` [RFC] new timeofday timesources (v.A1) john stultz
2004-12-08  2:02       ` john stultz
2004-12-08  9:17   ` [RFC] new timeofday core subsystem (v.A1) Pavel Machek
2004-12-08 18:44   ` Christoph Lameter
2004-12-08 19:22     ` john stultz
2004-12-08 18:53   ` Christoph Lameter
2004-12-08 20:27   ` Martin Waitz
     [not found]     ` <1102555933.1281.301.camel@cog.beaverton.ibm.com>
2004-12-09  7:32       ` Martin Waitz
2004-12-08 18:25 ` [RFC] New timeofday proposal (v.A1) Christoph Lameter
2004-12-08 19:11   ` john stultz [this message]
2004-12-08 19:20     ` Christoph Lameter
2004-12-08 19:58       ` john stultz
2004-12-08 20:14         ` Christoph Lameter
2004-12-08 21:25           ` George Anzinger
2004-12-08 23:47             ` Christoph Lameter
2004-12-08 23:36           ` john stultz
2004-12-08 23:53             ` Christoph Lameter
2004-12-09  0:17               ` john stultz
2004-12-09  0:40                 ` Christoph Lameter
2004-12-09  0:51                   ` john stultz
2004-12-09  1:24                     ` Christoph Lameter
2004-12-09  7:57             ` Ulrich Windl
2004-12-09  8:29               ` john stultz
2004-12-09  7:47         ` Ulrich Windl
2004-12-08 18:43 ` Nicolas Pitre
2004-12-08 18:57   ` john stultz

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=1102533066.1281.81.camel@cog.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=ak@suse.de \
    --cc=albert@users.sourceforge.net \
    --cc=amax@us.ibm.com \
    --cc=clameter@sgi.com \
    --cc=davidm@hpl.hp.com \
    --cc=george@mvista.com \
    --cc=gone@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=kmannth@us.ibm.com \
    --cc=lcm@us.ibm.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.de \
    --cc=mahuja@us.ibm.com \
    --cc=paulus@samba.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tim@physik3.uni-rostock.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

all inboxes | Powered by JetHome®