Re: HPET timer broken using 2.6.23.13 / nanosleep() hangs

From: Thomas Gleixner
Date: Wed Jan 16 2008 - 09:21:55 EST


On Sun, 13 Jan 2008, Dhaval Giani wrote:
> On Sun, Jan 13, 2008 at 08:10:46AM -0500, Andrew Paprocki wrote:
> > I applied the patch to my 2.6.23.13 tree and upon reboot it stopped right after:
> >
> > Clocksource tsc unstable (delta = ... ns)
> > Time: hpet clocksource has been installed.
> >
> > It locked up hard.. cursor stopped blinking and SysRq isn't working either.

The hint is in the original report:

Clocksource tsc unstable (delta = 500013666 ns)

That means, that the TSC was counting, but HPET not. So it looks like
the HPET readout is stale. Which explains, why after switching to HPET
clocksource the time system gets hosed.

I wonder why the HPET counter works check did not catch this.

Can you please apply the path below and provide the output ?

Thanks,

tglx

Index: linux-2.6/arch/x86/kernel/hpet.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/hpet.c 2008-01-16 08:29:28.000000000 +0100
+++ linux-2.6/arch/x86/kernel/hpet.c 2008-01-16 15:13:19.000000000 +0100
@@ -323,7 +323,7 @@ static struct clocksource clocksource_hp
static int hpet_clocksource_register(void)
{
u64 tmp, start, now;
- cycle_t t1;
+ cycle_t t1, t2;

/* Start the counter */
hpet_start_counter();
@@ -343,12 +343,17 @@ static int hpet_clocksource_register(voi
rdtscll(now);
} while ((now - start) < 200000UL);

- if (t1 == read_hpet()) {
+ t2 = read_hpet();
+ if (t1 == t2) {
printk(KERN_WARNING
"HPET counter not counting. HPET disabled\n");
return -ENODEV;
}

+ printk(KERN_INFO "HPET check: t1=%lu t2=%lu s=%lu n=%lu\n",
+ (unsigned long) t1, (unsigned long) t2,
+ (unsigned long) start, (unsigned long) now);
+
/* Initialize and register HPET clocksource
*
* hpet period is in femto seconds per cycle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/