From: George Anzinger <george@mvista.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Andrea Arcangeli <andrea@suse.de>, Pavel Machek <pavel@suse.cz>,
john stultz <johnstul@us.ibm.com>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
Con Kolivas <kernel@kolivas.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dynamic tick patch
Date: Fri, 21 Jan 2005 12:23:21 -0800 [thread overview]
Message-ID: <41F164B9.3030805@mvista.com> (raw)
In-Reply-To: <20050121173549.GC14554@atomide.com>
Tony Lindgren wrote:
> * George Anzinger <george@mvista.com> [050120 15:10]:
>
>>Tony Lindgren wrote:
>>
>>>* George Anzinger <george@mvista.com> [050119 16:25]:
>>>
>>>
>>>>Tony Lindgren wrote:
>>>>
>>>>
>>>>>* George Anzinger <george@mvista.com> [050119 15:00]:
>>>>>
>>>>>
>>>>>
>>>>>>I don't think you will ever get good time if you EVER reprogramm the
>>>>>>PIT. That is why the VST patch on sourceforge does NOT touch the PIT,
>>>>>>it only turns off the interrupt by interrupting the interrupt path (not
>>>>>>changing the PIT). This allows the PIT to be the "gold standard" in
>>>>>>time that it is designed to be. The wake up interrupt, then needs to
>>>>>>come from an independent timer. My patch requires a local APIC for
>>>>>>this. Patch is available at
>>>>>>http://sourceforge.net/projects/high-res-timers/
>>>>>
>>>>>
>>>>>Well on my test systems I have pretty good accurate time. But I agree,
>>>>>PIT is not the best option for interrupt. It should be possible to use
>>>>>other interrupt sources as well.
>
>
> But then again reprogramming PIT in my patch should not be that bad,
> as it's not done under load.
>
>
>>>>>It should not matter where the timer interrupt comes from, as long as
>>>>>it comes when programmed. Updating time should be separate from timer
>>>>>interrupts. Currently we have a problem where time is tied to the
>>>>>timer interrupt.
>>>>
>>>>In the HRT code time is most correctly stated as wall_time +
>>>>get_arch_cycles_since(wall_jiffies) (plus conversion or two:)). This is
>>>>some what removed from the tick interrupt, but is resynced to that
>>>>interrupt more or less each interrupt.
>>>
>>>
>>>That sounds very accurate :)
>>>
>>>
>>>
>>>>A second issue is trying to get the jiffies update as close to the run of
>>>>the timer list as possible. Without this we have no hope of high res
>>>>timers.
>>>
>>>
>>>OK. But if the timer interrupt is separated from updating the time,
>>>the next timer interrupt should be programmable to happen exactly
>>>when a HRT timer needs it, right?
>>
>>First, HRT uses a two phase system of timing. The first phase is the
>>normal timer list expires the timer. The timer is then handed to the high
>>res code which keeps a list of timers that are to expire prior to the next
>>jiffie. An interrupt is scheduled to make this happen. Depending on the
>>hardware available, this can come from the same timer or a different timer.
>>For example on x86 systems with a local apic we use the apic timer to
>>generate this interrupt. It triggers either a tasklet for UP or SMP with
>>out per cpu timers or a soft irq for SMP systems with per cpu timers.
>>
>>What this means is that, for timers near but just after a jiffie, the
>>run_timer list being late can make the HR timer late.
>
>
> Thanks for explaining that. So basically catching up with jiffies after
> skipping ticks could easily delay the HRT timer.
Any due in the "skipped time" would be late, as would any normal timers due
during that time.
>
> If jiffies was calculated from hw timer, updating time after skipping
> jiffies would be fast, and then this problem would go away, right?
No, you are still pulling the timers out of the timer list long after they
should have expired.
>
>
>>This code on on sourceforge if you want a closer look...
>
>
> I'll take a look at it.
>
>
>>>Hmm, how about using a pool of programmable timers available on the
>>>system for the timer interrupts and HRT? Or is one interrupt source
>>>always enough?
>>
>>Hardware heaven :), but no thanks. A reliable tick generator for the
>>jiffies timer and one additional timer (or one per cpu) works well in the
>>x86.
>>
>>If you have something like the PPC where you can mess with the timer with
>>out loosing time, that works well also. The correct formulation would be a
>>"clock" that can be read quickly and a timer tied to the same "rock" that
>>uses the same count units as the clock. PARISC has a counter that just
>>counts and a compare register. When they are equal an interrupt is
>>generated. That is a nice set up.
>
>
> Yes, many ARMs have this setup as well.
>
>
>>Now the X86 is bad and has little hope of being fixed for these reasons:
>>a.) the TSC is fast and easy to read but its not clocked at any given
>>frequency and, on some platforms, it changes without notifying the software.
>>b.) the PIT and the PMTIMER are both in I/O space and so take forever to
>>access.
>>c.) All three of these use different units (but at least the PMTIMER is
>>(supposed to be) related to the PIT clock.
>>d.) the HPET, again is in I/O space. I suspect that it uses a reasonable
>>"rock" but, as I understand it, it knocks out the PIT and, of course it
>>uses units unrelated to all the others.
>
>
> The timers on x86 are quite messy...
AMEN!
>
> Tony
>
--
George Anzinger george@mvista.com
High-res-timers: http://sourceforge.net/projects/high-res-timers/
next prev parent reply other threads:[~2005-01-21 20:23 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-19 0:05 [PATCH] dynamic tick patch Tony Lindgren
2005-01-19 0:22 ` Lee Revell
2005-01-19 1:04 ` Tony Lindgren
2005-01-19 4:21 ` Benjamin Herrenschmidt
2005-01-19 5:07 ` Tony Lindgren
2005-01-19 5:21 ` Tony Lindgren
2005-01-19 5:44 ` Benjamin Herrenschmidt
2005-01-19 6:26 ` Tony Lindgren
2005-01-19 9:45 ` Pavel Machek
2005-01-19 5:28 ` Benjamin Herrenschmidt
2005-01-19 6:37 ` Tony Lindgren
2005-01-19 7:08 ` Benjamin Herrenschmidt
2005-01-19 7:31 ` Tony Lindgren
2005-01-19 14:11 ` Stephen Frost
2005-01-19 17:17 ` Tony Lindgren
[not found] ` <OFDC470564.D4624EB3-ON41256F8E.00512848-41256F8E.005428CC@de.ibm.com>
2005-01-19 17:37 ` Tony Lindgren
2005-01-19 9:43 ` Pavel Machek
2005-01-19 17:13 ` Tony Lindgren
2005-01-19 17:48 ` Andrea Arcangeli
2005-01-19 18:19 ` Tony Lindgren
2005-01-19 19:12 ` Andrea Arcangeli
2005-01-19 19:17 ` Tony Lindgren
2005-01-19 19:34 ` Tony Lindgren
2005-01-19 22:42 ` Andrea Arcangeli
2005-01-19 22:59 ` George Anzinger
2005-01-19 23:17 ` Tony Lindgren
2005-01-20 0:24 ` George Anzinger
2005-01-20 8:04 ` Tony Lindgren
2005-01-20 23:10 ` George Anzinger
2005-01-21 17:35 ` Tony Lindgren
2005-01-21 20:23 ` George Anzinger [this message]
2005-01-19 23:26 ` Thomas Gleixner
2005-01-19 23:45 ` john stultz
2005-01-20 5:56 ` Thomas Gleixner
2005-01-20 0:39 ` George Anzinger
2005-01-20 3:15 ` Valdis.Kletnieks
2005-01-19 11:36 ` Pavel Machek
2005-01-19 17:11 ` Tony Lindgren
2005-01-19 17:30 ` Arjan van de Ven
2005-01-19 17:41 ` Tony Lindgren
2005-01-19 22:06 ` Pavel Machek
2005-01-19 23:08 ` Tony Lindgren
2005-01-19 23:46 ` Pavel Machek
2005-01-19 23:53 ` Tony Lindgren
2005-01-19 23:59 ` Pavel Machek
2005-01-20 0:07 ` Tony Lindgren
2005-01-20 0:44 ` Pavel Machek
2005-01-20 0:54 ` Pavel Machek
2005-01-20 7:39 ` Tony Lindgren
2005-01-19 22:20 ` Pavel Machek
2005-01-20 4:02 ` Zwane Mwaikambo
2005-01-21 17:48 ` Tony Lindgren
2005-01-21 18:27 ` Zwane Mwaikambo
2005-01-21 18:38 ` Tony Lindgren
2005-01-21 18:54 ` Pavel Machek
2005-01-21 21:23 ` Zwane Mwaikambo
2005-01-21 21:29 ` Pavel Machek
2005-01-21 20:25 ` George Anzinger
2005-01-21 21:38 ` Zwane Mwaikambo
2005-01-22 7:24 ` George Anzinger
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=41F164B9.3030805@mvista.com \
--to=george@mvista.com \
--cc=andrea@suse.de \
--cc=johnstul@us.ibm.com \
--cc=kernel@kolivas.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@suse.cz \
--cc=schwidefsky@de.ibm.com \
--cc=tony@atomide.com \
--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