From: Eli Carter <eli.carter@inet.com>
To: Russell King <rmk@arm.linux.org.uk>
Cc: Jamie Lokier <lk@tantalophile.demon.co.uk>, linux-kernel@vger.kernel.org
Subject: Re: gettimeofday question
Date: Mon, 19 Mar 2001 13:49:04 -0600 [thread overview]
Message-ID: <3AB662B0.A3FB2135@inet.com> (raw)
In-Reply-To: <200103191906.TAA01646@raistlin.arm.linux.org.uk>
Russell King wrote:
>
> Eli Carter writes:
> > Russell, I know that at least the EBSA285's timer1_gettimeoffset() needs
> > some attention to fix a time going backward problem.
>
> I know about this, which is what started me looking at what x86 does,
> and I am firmly of the conclusion that x86 is buggy as it stands.
Ah, OK.
> I believe that we can, instead of having a per-machine fix on ARM, have
> a generic fix. At the moment, I haven't worked out exactly what this
> generic fix would be.
>
> > The problem is only going to occur if gettimeoffset has not been called
> > in the past 10ms. Once 10ms has passed, either jiffies has changed, or
> > count will have passed count_p.
>
> My concern with the x86 fix is what if 9.9999999999ms has passed since the
> last timer tick, and we got the timer tick after we disabled interrupts and
> entered do_gettimeofday. This can lead to the tests in there miscorrecting
> IMHO. You won't see it with an infinite loop reading the time of day...
Hmm... I'm not seeing it quite yet...
do_gettimeofday doesn't
-- disable interrupts for do_gettimeofday
-- interrupt raised for "TIMER1" (or isa timer or whatever), the timer's
counter wraps back to the value of LATCH and begins decrementing.
-- we make a copy of xtime
-- gettimeoffset is called. Assuming it has been called less than 10ms
ago, (jiffies_t == jiffies_p && count > count_p) is true, so we adjust
the 10ms for that, and return the number of usecs since the last jiffie
change.
-- add the offset, bringing us up to the correct time
-- lost_ticks adjusts for the number of jiffies that have been counted
but not added to xtime (and thus has no impact on the gettimeoffset
logic)
(so, shouldn't this be "tv->tv_usec += lost_ticks *
USECS_PER_JIFFY;"?
or can lost_ticks never be greater than 1?)
-- restore interrupts
-- jiffies & lost_ticks get incremented
What are you seeing that I'm missing?
> I'll re-read your mail in more depth later tonight. Appologies if this
> reply appears to be a little early.
No problem. I'd like to see this code fixed correctly, so I'm happy to
help.
C-ya,
Eli
-----------------------. Rule of Accuracy: When working toward
Eli Carter | the solution of a problem, it always
eli.carter(at)inet.com `------------------ helps if you know the answer.
next prev parent reply other threads:[~2001-03-19 19:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-03 12:49 gettimeofday question Russell King
2001-03-03 16:24 ` Russell King
2001-03-19 7:33 ` Russell King
2001-03-19 11:39 ` Jamie Lokier
2001-03-19 18:26 ` Eli Carter
2001-03-19 19:06 ` Russell King
2001-03-19 19:49 ` Eli Carter [this message]
2001-03-19 21:34 ` Russell King
2001-03-19 22:54 ` Eli Carter
2001-03-19 23:44 ` Russell King
2001-03-20 15:27 ` Eli Carter
2001-03-21 22:14 ` Eli Carter
2001-03-21 22:27 ` Eli Carter
2001-03-21 23:10 ` Eli Carter
2001-03-21 23:27 ` Question on binutils release to use Anthony Barbachan
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=3AB662B0.A3FB2135@inet.com \
--to=eli.carter@inet.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lk@tantalophile.demon.co.uk \
--cc=rmk@arm.linux.org.uk \
/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