From: Andrea Arcangeli <andrea@suse.de>
To: Pavel Machek <pavel@suse.cz>
Cc: Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Con Kolivas <kernel@kolivas.org>,
linux-kernel@vger.kernel.org
Subject: Re: dynamic-hz
Date: Tue, 14 Dec 2004 03:36:51 +0100 [thread overview]
Message-ID: <20041214023651.GT16322@dualathlon.random> (raw)
In-Reply-To: <20041213191249.GB1052@elf.ucw.cz>
On Mon, Dec 13, 2004 at 08:12:49PM +0100, Pavel Machek wrote:
> Hi!
>
> > > But that does not matter, right? Yes, one-shot timer will not fire
> > > exactly at right place, but as long as you are reading TSC and basing
> > > next shot on current time, error should not accumulate.
> >
> > As said in the rest of the message, the error (or some other error)
> > accumulates heavily today in the tick-loss compensation/adjustment
> > algorithm in arch/i386/kernel/timers/timer_tsc.c, so I'm sceptical
> > about
>
> I do not see how it should accumulate. Lets have working TSC. You want
> to emulate fixed-period timer with single-shot timer.
>
> int should_fire_at;
>
> void handle_single_shot()
> {
> int delay;
> retry:n
> should_fire_at += loops_per_second/HZ
> delay = should_fire_at - get_tsc();
> if (delay < 0)
> goto retry;
Here you get a 10minute long NMI and you're automatically 10 minute in
the past (or your event gets a 10 sec introduced delay) without a way to
track it down.
Now in theory we might run this critical section into some special
section and we could restart it by updating regs->eip before returning
form the nmi. But that still leaves the unfixable window introduced by
the cpu not executing the tsc read and the do_single_shot_in atomically.
Given my recent experience with the lost tick compensation code that has
exactly the same window, I'm not optimistic it's going to keep the system
time uptodate accurately. Perhaps the apic is a lot faster and the error
won't propagate visibly. I'm not against trying but the thing about the
one-shot timer system time accuracy is a lot more complicated than this
pseudocode, and it's not obvious at all that your pseducode will work.
> do_single_shot_in(delay);
The only other way would be to use the 64bit tsc as the only source for
the system time (perhaps that's what you mean with the above
pseudocode?). But the calibration code would need changes to allow that.
Today we use the calibration divisor only in a small range so the
calibration can be quick and this way changing CPU frequency to the cpu
is also easier.
Even before thinking at using the one-shot timer, I would like to
fix the lost tick compensation of current production 2.6.9, only then we
can talk about tickless by using a one-shot timer. If we can't do the
lost-tick compensation without screwing the system time, I don't see how
we can do the one-shot timer without screwing the system time.
The lost tick compensation as well could be avoided if we use the TSC as
the source for gettimeofday and we ignore the PIT completely and we use
the PIT only to wakeup the cpu once in a while. *Then* we could convert
the PIT to a one-shot timer trivially too, but as said above the
accuracy of the divisor isn't enough and I've no idea if we can get a
real calibration that lasts more than a few hours.
My fast_gettimeoffset_quotient is set to 0x2f0271, that means the last
significant bit of the fast_gettimeoffset_quotient will showup in the
gettimeofday last singificant bit, after the tsc counted 2**32 ticks,
that means after less then 4 seconds in my computers at >1ghz. That's
why the gettimeoffset will never return anything longer than 1/HZ, so
the error cannot propagate in userspace.
next prev parent reply other threads:[~2004-12-14 2:37 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-11 14:23 dynamic-hz Andrea Arcangeli
2004-12-11 14:50 ` dynamic-hz Zwane Mwaikambo
2004-12-12 6:57 ` dynamic-hz Andrea Arcangeli
2004-12-11 21:41 ` dynamic-hz Jan Engelhardt
2004-12-12 16:35 ` dynamic-hz Pavel Machek
2004-12-12 22:23 ` dynamic-hz Andrea Arcangeli
2004-12-12 23:36 ` dynamic-hz Con Kolivas
2004-12-12 23:42 ` dynamic-hz Pavel Machek
2004-12-13 0:09 ` dynamic-hz Con Kolivas
2004-12-13 8:37 ` dynamic-hz Jan Engelhardt
2004-12-13 10:43 ` dynamic-hz Pavel Machek
2004-12-13 11:08 ` dynamic-hz Andrea Arcangeli
2004-12-13 19:36 ` dynamic-hz john stultz
2004-12-12 23:43 ` dynamic-hz Andrea Arcangeli
2004-12-13 0:18 ` dynamic-hz Con Kolivas
2004-12-13 0:27 ` dynamic-hz Andrea Arcangeli
2004-12-13 1:50 ` dynamic-hz Zwane Mwaikambo
2004-12-13 11:28 ` dynamic-hz Andrea Arcangeli
2004-12-13 12:43 ` dynamic-hz Pavel Machek
2004-12-13 12:58 ` dynamic-hz Andrea Arcangeli
2004-12-13 19:12 ` dynamic-hz Pavel Machek
2004-12-13 20:34 ` dynamic-hz john stultz
2004-12-13 20:49 ` dynamic-hz Pavel Machek
2004-12-14 2:04 ` dynamic-hz Andrea Arcangeli
[not found] ` <20041214013924.GB14617@atomide.com>
2004-12-14 9:37 ` dynamic-hz Pavel Machek
2004-12-14 21:18 ` dynamic-hz Tony Lindgren
2004-12-14 22:06 ` dynamic-hz Pavel Machek
2004-12-14 23:00 ` dynamic-hz linux-os
2004-12-14 23:13 ` dynamic-hz Tony Lindgren
2004-12-22 20:02 ` dynamic-hz Tony Lindgren
2004-12-14 23:04 ` dynamic-hz Tony Lindgren
2004-12-14 2:46 ` dynamic-hz Andrea Arcangeli
2004-12-14 19:24 ` dynamic-hz john stultz
2004-12-14 2:36 ` Andrea Arcangeli [this message]
2004-12-14 9:39 ` dynamic-hz Pavel Machek
2004-12-14 9:59 ` dynamic-hz Pavel Machek
2004-12-14 15:25 ` dynamic-hz Andrea Arcangeli
2004-12-14 22:02 ` USB making time drift [was Re: dynamic-hz] Pavel Machek
2004-12-14 23:16 ` Andrea Arcangeli
2004-12-15 2:59 ` Gene Heskett
2004-12-15 9:17 ` Andrea Arcangeli
2004-12-15 16:44 ` Gene Heskett
2004-12-15 18:20 ` Andrea Arcangeli
2004-12-16 1:59 ` Gene Heskett
2004-12-16 11:30 ` Andrea Arcangeli
2004-12-16 12:50 ` Alan Cox
2004-12-15 20:16 ` Pavel Machek
2004-12-16 2:02 ` Gene Heskett
2004-12-15 17:03 ` Gene Heskett
2004-12-15 17:48 ` Tim Schmielau
2004-12-16 2:03 ` Gene Heskett
2004-12-16 0:58 ` Pavel Machek
2004-12-16 2:33 ` john stultz
2004-12-16 1:15 ` Time goes crazy in 2.6.9 after long cli [was Re: USB making time drift] Pavel Machek
2004-12-16 11:13 ` Andrea Arcangeli
2004-12-16 12:49 ` Alan Cox
2004-12-13 14:50 ` dynamic-hz Zwane Mwaikambo
2004-12-13 7:43 ` dynamic-hz Stefan Seyfried
2004-12-13 13:58 ` dynamic-hz Russell King
2004-12-13 14:14 ` dynamic-hz Russell King
2004-12-13 14:52 ` dynamic-hz Alan Cox
2004-12-13 16:23 ` dynamic-hz Russell King
2004-12-13 17:53 ` dynamic-hz Michael Buesch
2004-12-13 18:04 ` dynamic-hz Russell King
2004-12-13 19:04 ` dynamic-hz Pavel Machek
2004-12-13 20:11 ` dynamic-hz Russell King
2004-12-14 0:16 ` dynamic-hz Eric St-Laurent
2004-12-15 18:04 ` dynamic-hz Alan Cox
2004-12-15 19:54 ` dynamic-hz linux-os
2004-12-16 2:17 ` dynamic-hz Gene Heskett
2004-12-16 12:42 ` dynamic-hz linux-os
2004-12-17 20:12 ` dynamic-hz H. Peter Anvin
2004-12-16 9:10 ` dynamic-hz Gabriel Paubert
2004-12-16 12:17 ` dynamic-hz Geert Uytterhoeven
2004-12-16 14:00 ` dynamic-hz Mitchell Blank Jr
2004-12-13 15:30 ` dynamic-hz Zwane Mwaikambo
2004-12-13 15:59 ` dynamic-hz Russell King
2004-12-13 16:14 ` dynamic-hz Pavel Machek
2004-12-13 16:06 ` dynamic-hz Pavel Machek
2004-12-13 16:19 ` dynamic-hz Jan Engelhardt
2004-12-13 8:29 ` dynamic-hz Jan Engelhardt
2004-12-14 22:54 ` dynamic-hz Lee Revell
2004-12-14 23:38 ` dynamic-hz Chris Friesen
2004-12-15 8:32 ` dynamic-hz Jan Engelhardt
2004-12-13 11:02 ` dynamic-hz Andrew Morton
2004-12-13 11:17 ` dynamic-hz Andrea Arcangeli
2004-12-13 11:25 ` dynamic-hz Andrew Morton
2004-12-13 11:47 ` dynamic-hz Andrea Arcangeli
2004-12-14 3:56 ` dynamic-hz Nish Aravamudan
2004-12-14 3:54 ` dynamic-hz Nish Aravamudan
2004-12-14 4:29 ` dynamic-hz Andrew Morton
2004-12-14 5:25 ` dynamic-hz Nish Aravamudan
2004-12-17 20:10 ` dynamic-hz Nish Aravamudan
2004-12-14 10:01 ` dynamic-hz Domen Puncer
2004-12-14 16:56 ` dynamic-hz Nish Aravamudan
2004-12-14 14:23 ` dynamic-hz linux-os
2004-12-14 16:54 ` dynamic-hz Nish Aravamudan
2004-12-14 17:15 ` dynamic-hz Andrea Arcangeli
2004-12-14 17:42 ` dynamic-hz Nish Aravamudan
2004-12-14 18:29 ` dynamic-hz Andrea Arcangeli
2004-12-14 19:00 ` dynamic-hz Nish Aravamudan
2004-12-14 18:22 ` dynamic-hz linux-os
2004-12-14 18:38 ` dynamic-hz Andrea Arcangeli
2004-12-14 18:50 ` dynamic-hz Pavel Machek
2004-12-13 11:19 ` dynamic-hz Hans Kristian Rosbach
2004-12-13 11:22 ` dynamic-hz Pavel Machek
2004-12-13 11:39 ` dynamic-hz Andrea Arcangeli
2004-12-13 12:51 ` dynamic-hz Hans Kristian Rosbach
2004-12-13 13:01 ` dynamic-hz Andrea Arcangeli
2004-12-13 13:02 ` dynamic-hz Andrea Arcangeli
2004-12-13 15:06 ` dynamic-hz Geert Uytterhoeven
2004-12-13 16:12 ` dynamic-hz Pavel Machek
2004-12-13 16:14 ` dynamic-hz Geert Uytterhoeven
2004-12-14 4:06 ` dynamic-hz Nish Aravamudan
2004-12-14 4:05 ` dynamic-hz Nish Aravamudan
2004-12-13 11:33 ` dynamic-hz Andrea Arcangeli
2004-12-13 14:38 ` dynamic-hz Zwane Mwaikambo
2004-12-13 12:00 ` dynamic-hz Alan Cox
2004-12-13 15:52 ` dynamic-hz Andrea Arcangeli
2004-12-14 22:28 ` dynamic-hz Lee Revell
2004-12-14 22:40 ` dynamic-hz Con Kolivas
2004-12-14 22:50 ` dynamic-hz Lee Revell
2004-12-13 20:26 ` dynamic-hz Olaf Hering
2004-12-13 22:41 ` dynamic-hz Andrea Arcangeli
2004-12-13 20:56 ` dynamic-hz john stultz
2004-12-13 22:21 ` dynamic-hz Andrea Arcangeli
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=20041214023651.GT16322@dualathlon.random \
--to=andrea@suse.de \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
--cc=zwane@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