mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>,
	tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: Ktimer / -rt9 (+custom) monotonic_clock going backwards.
Date: Thu, 20 Oct 2005 03:46:53 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0510200340110.27683@localhost.localdomain> (raw)
In-Reply-To: <20051020073416.GA28581@elte.hu>


On Thu, 20 Oct 2005, Ingo Molnar wrote:

>
> if the bug is only possible when timesources are changed on the fly,
> then i think it shouldnt happen. We pick our sources at bootup time and
> stick with them.
>
> in the -rt tree we also have clockevents and HRT support, so the clocks
> used should depend on whether you have the APIC enabled in the .config,
> and whether the BIOS has it enabled by default. If the BIOS has the APIC
> disabled then you can force the kernel to enable it by adding "lapic" to
> the boot-line.

On this test machine, I had to add the lapic command line, but that was
there when I first had to get NMI working on this machine back in the V0.7
days :-)


>
> without the APIC active, the equation is simple: we use the PIT for both
> jiffies and HRT. We use the TSC for gettimeofday. No interaction between
> the two.
>
> if the APIC is active, then we have both the local APIC timer interrupt
> for and the PIT for HRT timing. The clockevents framework sees both
> hardware clocks and automatically decides which one to use, based on
> their ranking. A typical PIT reprogramming PIO sequence takes 20-30
> usecs, while a typical APIC timer reprogramming takes ~5 nanoseconds on
> my box, so the choice is rather easy ;-) The jiffies interrupt is still
> off the PIT. gettimeofday is off the TSC counter.
>
> i could imagine the following hardware effects to cause time warps:
>
> - the TSC is in fact the 'read counter' method of the local APIC timer
>   hardware. So there can be interactions in theory: programming the APIC
>   timer could impact the TSC and vice versa. There have been CPU
>   erratums in this area in the past.

Could this cause a 2 second drop backwards?

>
> - powersaving can impact the TSC - and can thus impact the APIC timer
>   too. Errata-land as well.

Well, this machine is a normal PC not a laptop, and anyway, this backwards
clock happened during a stress test with pretty much 100% CPU usage, so I
think we can rule out power saving.

>
> - the TSC itself could have short, temporary warps. I had a box that
>   showed such effects.

Can this be a 2 second warp?

>
> besides hardware bugs, another, albeit very small possibility is that
> somewhere in the thousands of lines of shiny-new generic-time-of-day,
> ktimers, clockevents and high-res-timers code, there is a software bug,
> which is causing time warps ;-)
>

My older code first used jiffies as a timer, then I switched to TSC and
then to APIC timer, and then finally ktimer.  ktimer was the first to show
a backwards get_time.

-- Steve


  reply	other threads:[~2005-10-20  7:47 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-19 14:59 Steven Rostedt
2005-10-19 15:10 ` Thomas Gleixner
2005-10-19 18:39   ` john stultz
2005-10-20  6:55     ` Steven Rostedt
2005-10-20  7:34       ` Ingo Molnar
2005-10-20  7:46         ` Steven Rostedt [this message]
2005-10-20  8:01           ` Ingo Molnar
2005-10-20  8:56             ` Steven Rostedt
2005-10-20  8:59               ` Ingo Molnar
2005-10-20  9:04                 ` Steven Rostedt
2005-10-20  9:05                   ` Steven Rostedt
2005-10-20 10:05                   ` Steven Rostedt
2005-10-20 10:05                     ` Steven Rostedt
2005-10-20 15:55                       ` Ingo Molnar
2005-10-20 16:09                         ` Steven Rostedt
2005-10-20 16:45                       ` john stultz
2005-10-20 16:58                         ` Steven Rostedt
2005-10-20 17:05                           ` john stultz
2005-10-20 19:32                         ` Ingo Molnar
2005-10-20 20:05                           ` john stultz
2005-10-20 20:54                             ` Ingo Molnar
2005-10-21  6:03                           ` Steven Rostedt
2005-10-21  7:49                             ` Thomas Gleixner
2005-10-21  7:57                               ` Steven Rostedt
2005-10-21  8:00                               ` ktimer API Steven Rostedt
2005-10-21  8:09                                 ` Thomas Gleixner
2005-10-21 18:09                             ` Ktimer / -rt9 (+custom) monotonic_clock going backwards john stultz
2005-10-21 18:15                               ` Thomas Gleixner
2005-10-20 22:06           ` George Anzinger
2005-10-20  6:19   ` Steven Rostedt
2005-10-20 14:34   ` Steven Rostedt
2005-10-20 15:18     ` Steven Rostedt
2005-10-20 15:23       ` Steven Rostedt
2005-10-20 16:01       ` Steven Rostedt
2005-10-19 15:11 ` Ingo Molnar
2005-10-20  6:38   ` Steven Rostedt
2005-10-20  6:56     ` Ingo Molnar
2005-10-19 15:21 ` Daniel Walker
2005-10-20  6:39   ` Steven Rostedt
2005-10-20 15:02     ` Daniel Walker
2005-10-20 22:19       ` George Anzinger
2005-10-20 23:23         ` john stultz
2005-10-19 16:44 ` Frank Sorenson
2005-10-20  6:43   ` Steven Rostedt

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=Pine.LNX.4.58.0510200340110.27683@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®