public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Dror Cohen <dror.xiv@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Time Drift Compensation on Linux Clusters
Date: Thu, 03 Mar 2005 18:34:39 +0100	[thread overview]
Message-ID: <m1wtsofxao.fsf@muc.de> (raw)
In-Reply-To: <6c58e3190503030650595cbd5@mail.gmail.com> (Dror Cohen's message of "Thu, 3 Mar 2005 16:50:52 +0200")

Dror Cohen <dror.xiv@gmail.com> writes:

> Hi all,
> While working on a Linux cluster with kernel version 2.4.27 we've
> encountered a consistent clock drift problem. We have devised a fix

The normal fix is to use NTP.

The clock drift problem on lost ticks is known, but I don't
think your change is the right fix.

>
> In IO intensive environments a many CPU cycles are spent handling interrupts.
> This is done by the device driver code for the different IO devices.
> Typically, while
> dealing with the hardware, device drivers block other IRQs, including the PIT's
> (timer) IRQ.

Drivers are not supposed to block interrupts for a long time.
If they do in your environment it would be better to fix this.

> Each time a time interrupt is missed the system looses one jiffy.
> These lost jiffies
> accumulate into a consisting clock drift.

It doesn't. jiffies is not used in gettimeofday(), only xtime and
wall_jiffies is. Fixing up jiffies would at best help you against a 
"uptime drift" and make the kernel internal timers a bit more accurate.

Did you really test your code? I bet it doesn't help.

In general using the TSC like this is also dangerous, because
there are system where its rate is not stable (e.g. it can vary
when the CPU changes to lower frequencies for power saving) 

BTW when you submit any patches do it in diff -u format and ready
to apply. Your form is very reviewer and user unfriendly.

> 	> #ifdef X86_TSC_DRIFT_COMPENSATION
> 	>       __u64 cycles = get_cycles();
> 	>       while (xtdc_last < cycles) {
> 	>               (*(unsigned long *)&jiffies)++;

This is also wrong because jiffies is really a 64bit variable.

-Andi

      parent reply	other threads:[~2005-03-03 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-03 14:50 Time Drift Compensation on Linux Clusters Dror Cohen
2005-03-03 16:23 ` Chris Friesen
2005-03-03 16:24 ` Baruch Even
2005-03-03 17:34 ` Andi Kleen [this message]

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=m1wtsofxao.fsf@muc.de \
    --to=ak@muc.de \
    --cc=dror.xiv@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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