linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: 2.5.64 and jiffies wrap
  2003-03-07 13:05 2.5.64 and jiffies wrap Jens Axboe
@ 2003-03-07 12:15 ` Andrew Morton
  2003-03-07 13:20   ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-03-07 12:15 UTC (permalink / raw)
  To: Jens Axboe; +Cc: tim, linux-kernel

Jens Axboe <axboe@suse.de> wrote:
>
> Hi,
> 
> The patch doesn't look right, why is INITIAL_JIFFIES being cast to
> unsigned int? This breaks x86_64 at least.
> 
> ...
> -#define INITIAL_JIFFIES ((unsigned int) (-300*HZ))

This sets the initial jiffies value to 0x00000000fffb6c20, which can trigger
32-bit wraparound bugs: if some random jiffy counter wraps from
0x00000000ffffffff to 0x0000000000000000 then things fail.

davem was bitten by at least one such bug in the qlogicfc driver.  It would
have caused 64-bit machines to fail after 49 days.

It turns out that it is more valuable to test for this than to test for
64-bit wraparound bugs.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 2.5.64 and jiffies wrap
@ 2003-03-07 13:05 Jens Axboe
  2003-03-07 12:15 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2003-03-07 13:05 UTC (permalink / raw)
  To: tim, akpm; +Cc: Linux Kernel

Hi,

The patch doesn't look right, why is INITIAL_JIFFIES being cast to
unsigned int? This breaks x86_64 at least.

--- /opt/kernel/linux-2.5.64/arch/x86_64/kernel/time.c	2003-03-07 13:54:40.000000000 +0100
+++ linux-2.5.64/arch/x86_64/kernel/time.c	2003-03-07 13:17:58.000000000 +0100
@@ -30,7 +30,7 @@
 #include <asm/apic.h>
 #endif
 
-u64 jiffies_64;
+u64 jiffies_64 = INITIAL_JIFFIES;
 
 extern int using_apic_timer;
 
--- /opt/kernel/linux-2.5.64/include/linux/time.h	2003-03-07 13:54:41.000000000 +0100
+++ linux-2.5.64/include/linux/time.h	2003-03-07 13:18:10.000000000 +0100
@@ -31,7 +31,7 @@
  * Have the 32 bit jiffies value wrap 5 minutes after boot
  * so jiffies wrap bugs show up earlier.
  */
-#define INITIAL_JIFFIES ((unsigned int) (-300*HZ))
+#define INITIAL_JIFFIES ((unsigned long) (-300*HZ))
 
 /*
  * Change timeval to jiffies, trying to avoid the

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.5.64 and jiffies wrap
  2003-03-07 12:15 ` Andrew Morton
@ 2003-03-07 13:20   ` Jens Axboe
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2003-03-07 13:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: tim, linux-kernel

On Fri, Mar 07 2003, Andrew Morton wrote:
> Jens Axboe <axboe@suse.de> wrote:
> >
> > Hi,
> > 
> > The patch doesn't look right, why is INITIAL_JIFFIES being cast to
> > unsigned int? This breaks x86_64 at least.
> > 
> > ...
> > -#define INITIAL_JIFFIES ((unsigned int) (-300*HZ))
> 
> This sets the initial jiffies value to 0x00000000fffb6c20, which can trigger
> 32-bit wraparound bugs: if some random jiffy counter wraps from
> 0x00000000ffffffff to 0x0000000000000000 then things fail.
> 
> davem was bitten by at least one such bug in the qlogicfc driver.  It would
> have caused 64-bit machines to fail after 49 days.
> 
> It turns out that it is more valuable to test for this than to test for
> 64-bit wraparound bugs.

Ok makes sense, I thought the point was just to test for jiffies wrap.
Anyways, the patch breaks boot on x86_64 here.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-07 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-07 13:05 2.5.64 and jiffies wrap Jens Axboe
2003-03-07 12:15 ` Andrew Morton
2003-03-07 13:20   ` Jens Axboe

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).