lkml.org 
[lkml]   [2006]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Fix time going backward with clock=pit [1/2]
Hi,

On Thu, 18 May 2006, Tim Mann wrote:

> > I think the whole think should look
> > something like this:
> >
> > if (jiffies_t == jiffies_p) {
> > if (count > count_p) {
> > underflow or crappy timer;
>
> What should the code do in this case?

Basically the current do_timer_overflow().

> > }
> > } else {
> > jiffies_p = jiffies_t;
> > if (count > LATCH/2 && underflow)
> > count -= LATCH;
>
> I think I see what you're aiming at here: in the case where we read
> count, then the counter wraps, then we read jiffies, you want to detect
> that and fix it. Actually if you could detect that, the right way to
> fix it would be to set count = LATCH, since the old count is, well, old:
> the current time is right after the jiffy.

It's really "-= LATCH". :)

> However, we don't really have a way to detect that this case happened --
> the "&& underflow" in your code is a handwave.

Ok, I'm not that familiar with Intel hardware (it must be crappier than I
thought). Is there really no way to detect the pending interrupt (e.g.
what do_timer_overflow() does)? Without that information one can really
only guess the time.
It's not that important if it's not completely correct for SMP systems,
they usually have other sources, but for the few systems there this is the
only time source, we should at least make an effort to avoid the read
error.

bye, Roman
-
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: 2006-05-19 02:12    [W:0.031 / U:19.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site