linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Tim Schmielau <tim@physik3.uni-rostock.de>
Cc: Patrick Moor <pmoor@netpeople.ch>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: time jumps (again)
Date: Mon, 04 Aug 2003 15:38:11 -0700	[thread overview]
Message-ID: <3F2EE053.1020600@mvista.com> (raw)
In-Reply-To: <Pine.LNX.4.33.0308042347300.12309-100000@gans.physik3.uni-rostock.de>

Tim Schmielau wrote:
>>Some days ago I started noticing strange time jumps on my Athlon system.
>>(Asus board, VIA chipset, AMD Athlon 650MHz processor). I haven't
>>noticed them before and I am pretty sure there weren't any for the last
>>few years! Uptime of the machine is now 218 days, and problems began
>>appearing after 215 days approximately.
>>
>>What happens: when doing a
>>  $ while true; do date; done
>>I'm noticing time jumps _exactly_ at the beginning of a "new" second (or
>>at the end of an "old" one). the jump is exactly 4294 (4295) seconds
>>into the future. Example:
>>...
>>Mon Aug  4 18:11:06 CEST 2003
>>Mon Aug  4 18:11:06 CEST 2003
>>Mon Aug  4 19:22:41 CEST 2003
>>Mon Aug  4 19:22:41 CEST 2003
>>Mon Aug  4 19:22:41 CEST 2003
>>Mon Aug  4 18:11:07 CEST 2003
>>Mon Aug  4 18:11:07 CEST 2003
>>...
>>
> 
> 
> Wild guess - does the following patch fix it?

And your theory is that wall_jiffies > jiffies.  How does this happen? 
  Both of these are only changed under the write_irq lock....

I would feel better with a patch that made jiffies volatile, but it 
already is.

I agree that the jump implies overflow here, but just HOW is it happening?

Time for some dianostic code...

  Tim
> 
> 
> --- linux-2.4.20/arch/i386/kernel/time.c.orig	Mon Aug  4 23:38:47 2003
> +++ linux-2.4.20/arch/i386/kernel/time.c	Mon Aug  4 23:40:53 2003
> @@ -274,8 +274,8 @@
>  	read_lock_irqsave(&xtime_lock, flags);
>  	usec = do_gettimeoffset();
>  	{
> -		unsigned long lost = jiffies - wall_jiffies;
> -		if (lost)
> +		long lost = jiffies - wall_jiffies;
> +		if (lost>0)
>  			usec += lost * (1000000 / HZ);
>  	}
>  	sec = xtime.tv_sec;
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
George Anzinger   george@mvista.com
High-res-timers:  http://sourceforge.net/projects/high-res-timers/
Preemption patch: http://www.kernel.org/pub/linux/kernel/people/rml


  reply	other threads:[~2003-08-04 22:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-04 16:35 time jumps (again) Patrick Moor
2003-08-04 16:37 ` Alan Cox
2003-08-04 21:49 ` Tim Schmielau
2003-08-04 22:38   ` george anzinger [this message]
2003-08-05  1:08     ` Andries Brouwer
2003-08-06 18:16   ` Timothy Miller
2003-08-06 18:55     ` George Anzinger
2003-08-07  0:29     ` Andries Brouwer
2003-08-05 10:32 ` Jan Niehusmann

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=3F2EE053.1020600@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmoor@netpeople.ch \
    --cc=tim@physik3.uni-rostock.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;
as well as URLs for NNTP newsgroup(s).