public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vojtech Pavlik <vojtech@ucw.cz>
To: john stultz <johnstul@us.ibm.com>
Cc: "Bryan O'Sullivan" <bos@serpentine.com>, Andi Kleen <ak@suse.de>,
	vojtech@suse.cz, discuss@x86-64.org,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] New x86_64 time code for 2.5.70
Date: Thu, 12 Jun 2003 08:40:10 +0200	[thread overview]
Message-ID: <20030612084010.B12126@ucw.cz> (raw)
In-Reply-To: <1055378035.18643.95.camel@w-jstultz2.beaverton.ibm.com>; from johnstul@us.ibm.com on Wed, Jun 11, 2003 at 05:33:55PM -0700

On Wed, Jun 11, 2003 at 05:33:55PM -0700, john stultz wrote:
 
> This patch applies on top of Bryan's patch, and solves the major time
> inconsistencies I was seeing earlier. I don't like that I still have to
> have the sanity check on offset to ensure it doesn't go negative
> (frequently I get offsets of -1),

IMO this is to be expected and not a problem. In the case of offset of
'-1' the time will jump one usec forward on the timer interrupt, but
that's harmless and nothing worse should happen.

> and that along with the fact that I'm
> seeing a steady drift forward on every kernel I've run (2.4/2.5) makes
> me think that the timer interrupt frequency may be a bit higher then we
> intend. Might just be the dev hardware I'm running on, though.

The devel hardware's RTC crystals are quite a bit off the correct
frequency, but still in the range fixable by NTP.

> I'm also got some cleanup changes I'd like to make, but I'll wait until
> after things work to polish that stuff up. 
> 
> Let me know if you have any issues with this patch. 

Looks OK to me.

> thanks
> -john
> 
> diff -Nru a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
> --- a/arch/x86_64/kernel/time.c	Wed Jun 11 17:28:07 2003
> +++ b/arch/x86_64/kernel/time.c	Wed Jun 11 17:28:07 2003
> @@ -254,11 +254,14 @@
>  		vxtime.last = offset;
>  	} else {
>  		offset = (((tsc - vxtime.last_tsc) *
> -			   vxtime.tsc_quot) >> 32) - tick_usec;
> +			   vxtime.tsc_quot) >> 32) - (USEC_PER_SEC/HZ);
> +		/* sanity check on offset */
> +		if(offset < 0)
> +			offset = 0;
>  
> -		if (offset > tick_usec) {
> -			lost = offset / tick_usec;
> -			offset %= tick_usec;
> +		if (offset > (USEC_PER_SEC/HZ)) {
> +			lost = offset / (USEC_PER_SEC/HZ);
> +			offset %= (USEC_PER_SEC/HZ);
>  		}
>  
>  		vxtime.last_tsc = tsc - vxtime.quot * delay / vxtime.tsc_quot;
> @@ -275,10 +278,7 @@
>  			       "tick(s)! (rip %016lx)\n",
>  			       (offset - vxtime.last) / hpet_tick - 1,
>  			       regs->rip);
> -		// XXX The accounting of lost ticks is way off right
> -		// now. -bos
> -
> -		// jiffies += lost;
> +		jiffies += lost;
>  	}
>  
>  /*
> 
> 
> 

-- 
Vojtech Pavlik
SuSE Labs, SuSE CR

  reply	other threads:[~2003-06-12  6:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-11 18:50 [PATCH] New x86_64 time code for 2.5.70 Bryan O'Sullivan
2003-06-11 19:18 ` Andi Kleen
2003-06-11 19:56   ` Bryan O'Sullivan
2003-06-11 20:10     ` Bryan O'Sullivan
2003-06-11 21:23       ` john stultz
2003-06-11 21:36         ` Bryan O'Sullivan
2003-06-11 21:41           ` john stultz
2003-06-12  0:33           ` john stultz
2003-06-12  6:40             ` Vojtech Pavlik [this message]
2003-06-12 17:47             ` Bryan O'Sullivan
2003-06-12 19:39               ` john stultz
2003-06-12 19:55                 ` Vojtech Pavlik
2003-06-12 21:16                 ` Bryan O'Sullivan
2003-06-13  1:43                   ` john stultz
2003-06-12 19:48               ` Vojtech Pavlik
2003-06-11 20:41 ` Vojtech Pavlik
2003-06-11 20:44 ` john stultz
2003-06-11 21:32 ` Mika Penttilä
2003-06-11 21:28   ` Bryan O'Sullivan
2003-06-12  4:40     ` [discuss] " Andreas Jaeger
2003-06-12  6:42     ` Vojtech Pavlik
2003-06-12  6:47   ` Vojtech Pavlik

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=20030612084010.B12126@ucw.cz \
    --to=vojtech@ucw.cz \
    --cc=ak@suse.de \
    --cc=bos@serpentine.com \
    --cc=discuss@x86-64.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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