lkml.org 
[lkml]   [2007]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Fast assurate clock readable from user space and NMI handler
* Daniel Walker (dwalker@mvista.com) wrote:
> On Sat, 2007-02-24 at 11:19 -0500, Mathieu Desnoyers wrote:
> > Hi,
> >
> > I am trying to improve the Linux kernel time source so it can be read
> > without seqlock from NMI handlers. I have also seen some interest for
> > such an accurate monotonic clock readable from user space. It mainly
> > implies an atomic update of the time value. I am also trying to figure a
> > way to support architectures with multiple CPUs with non-synchronized
> > TSCs.
> >
> > I would like to have your comments on the following idea.
> >
> > Thanks in advance,
> >
> > Mathieu
> >
> >
> > Monotonic accurate time
> >
> > The goal of this design is to provide a monotonic time :
> >
> > Readable from userspace without a system call
> > Readable from NMI handler
> > Readable without disabling interrupts
> > Readable without disabling preemption
> > Only one clock source (most precise available : tsc)
> > Support architectures with variable TSC frequency.
>
> I don't think you could use only the tsc. From reviewing John, and
> Thomas work it's pretty clear the TSC isn't going to work correctly all
> the time.
>

Ok, if there are other high precision timers we can use, I guess it may
be better to fall back on them.

> > /* On frequency change event */
> > /* In irq context */
> > void freq_change_cb(unsigned int new_freq)
> > {
>
> It's possible for the TSC to change frequencies without notification. It
> can also completely stop when the system goes idle.
>

Hrm, I see. I though those freq change without notification would happen
rarely and could be dealt by resynchronizing the CPUs. I guess I was
wrong.

> > /* Userspace */
> > /* Export all this data to user space through the vsyscall page. Use a function
> > * like read_time to read the walltime. This function can be implemented as-is
> > * because it doesn't need to disable preemption. */
>
> What would be the benefit of using this over the vsyscall gettimeofday()
> from userspace ?
>

So we can get a monotonic, non NTP corrected timestamp quickly from user
space without going through a system call. Are there other alternatives ?

Thanks,

Mathieu

--
Mathieu Desnoyers
Computer Engineering Ph.D. Candidate, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-26 22:01    [W:0.113 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site