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

Thomas Gleixner
2008-01-16T15:23:17Z

On Wed, 16 Jan 2008, Thomas Gleixner wrote:

> On Wed, 16 Jan 2008, Thomas Gleixner wrote:
>
> > 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 ?

This time against 2.6.23

Thanks,
tglx

--- a/arch/i386/kernel/hpet.c
+++ b/arch/i386/kernel/hpet.c
@@ -233,7 +233,7 @@ int __init hpet_enable(void)
unsigned long id;
uint64_t hpet_freq;
u64 tmp, start, now;
- cycle_t t1;
+ cycle_t t1, t2;

if (!is_hpet_capable())
return 0;
@@ -295,12 +295,17 @@ int __init hpet_enable(void)
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");
goto out_nohpet;
}

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