From: David Mosberger <davidm@napali.hpl.hp.com>
To: "David S. Miller" <davem@redhat.com>
Cc: davidm@hpl.hp.com, Andrew Morton <akpm@digeo.com>,
Andi Kleen <ak@muc.de>, Arjan van de Ven <arjanv@redhat.com>,
john stultz <johnstul@us.ibm.com>,
linux-kernel@vger.kernel.org,
David Mosberger <davidm@napali.hpl.hp.com>
Subject: Re: time interpolation hooks
Date: Mon, 19 May 2003 10:34:43 -0700 [thread overview]
Message-ID: <16073.5555.158600.61609@napali.hpl.hp.com> (raw)
In-Reply-To: <1053139080.7308.6.camel@rth.ninka.net>
>>>>> On 16 May 2003 19:38:01 -0700, "David S. Miller" <davem@redhat.com> said:
DaveM> I think Andrew is really suggesting to declare these two
DaveM> things in an arch header, so if one needs it to be a function
DaveM> pointer one can make it so.
I don't think this should be (purely) an arch thing. It's just as
much a driver issue. For example, HPET will pretty much work the same
on x86 and ia64, so being able to have a shared "driver" would be
useful. I agree though that it would be nice if arches that don't
care for time-interpolation at all could turn it off completely.
In the proposal below, an architecture could achieve that by turning
off CONFIG_TIME_INTERPOLATION.
>>>>> On Sat, 17 May 2003 09:09:51 +0000, Arjan van de Ven <arjanv@redhat.com> said:
Arjan> I rather would have a "timer source" object that provides
Arjan> those 2 functions as methods, so that one can write "timer"
Arjan> drivers as more or less stand alone units that register
Arjan> themselves with the generic timekeeping unit (probably with
Arjan> an accuracy score so that the generic code can pick one in
Arjan> the event of multiple timer sources).
Sounds reasonable.
To make this really possible, I think it makes the most sense to have
the last_nsec_offset variable implemented by the generic kernel. I'm
thinking something along the lines of the below?
Comments?
--david
struct time_interpolator {
void (*update_wall_time) (long delta_nsec);
void (*reset_wall_time) (long delta_nsec);
unsigned long frequency; /* frequency in counts/second */
unsigned long drift; /* drift in parts-per-million (?) */
};
extern void register_time_interpolator (struct time_interpolator *ti);
extern void unregister_time_interpolator (struct time_interpolator *ti);
#ifdef CONFIG_TIME_INTERPOLATION
extern volatile unsigned long last_nsec_offset;
extern struct time_interpolator *time_interpolator;
static inline void
update_wall_time (long delta_nsec)
{
struct time_interpolator *ti = time_interpolator;
/* This needs to be done atomically, either via cmpxchg() or
protected by a spinlock: */
last_nsec_offset -= min(last_nsec_offset, delta_nsec);
if (ti)
(*ti->update_wall_time)(delta_nsec);
}
static inline void
reset_wall_time (long delta_nsec);
{
struct time_interpolator *ti = time_interpolator;
last_nsec_offset = 0;
if (ti)
(*ti->reset_wall_time)();
}
#else
static inline void
update_wall_time (long delta_nsec)
{
}
static inline void
reset_wall_time (long delta_nsec)
{
}
#endif
next prev parent reply other threads:[~2003-05-19 17:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-16 21:23 Andrew Morton
2003-05-16 22:00 ` David Mosberger
2003-05-17 2:38 ` David S. Miller
2003-05-19 17:34 ` David Mosberger [this message]
2003-05-19 17:42 ` Arjan van de Ven
2003-05-19 18:35 ` David Mosberger
2003-05-19 18:57 ` Andrew Morton
2003-05-20 7:26 ` David Mosberger
2003-05-19 22:37 ` David S. Miller
2003-05-19 23:03 ` David Mosberger
2003-05-19 23:08 ` David S. Miller
2003-05-17 9:09 ` Arjan van de Ven
2003-05-17 16:31 ` john stultz
2003-05-17 16:37 ` 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=16073.5555.158600.61609@napali.hpl.hp.com \
--to=davidm@napali.hpl.hp.com \
--cc=ak@muc.de \
--cc=akpm@digeo.com \
--cc=arjanv@redhat.com \
--cc=davem@redhat.com \
--cc=davidm@hpl.hp.com \
--cc=johnstul@us.ibm.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
all inboxes | Powered by JetHome®