Subject: Re: port-amd64/34550: system clock is drifting when amd64 Cool'n'Quiet
To: None <gnats-bugs@netbsd.org>
From: Frank Kardel <kardel@netbsd.org>
List: netbsd-bugs
Date: 09/18/2006 15:35:10
Pavel Cahyna wrote:

>The following reply was made to PR port-amd64/34550; it has been noted by GNATS.
>
>From: Pavel Cahyna <pavel@NetBSD.org>
>To: gnats-bugs@NetBSD.org
>Cc: 
>Subject: Re: port-amd64/34550: system clock is drifting when amd64 Cool'n'Quiet is used
>Date: Mon, 18 Sep 2006 11:21:12 +0200
>
> On Mon, Sep 18, 2006 at 07:45:02AM +0000, Martin Husemann wrote:
> > The following reply was made to PR port-amd64/34550; it has been noted by GNATS.
> > 
> > From: Martin Husemann <martin@duskware.de>
> > To: gnats-bugs@NetBSD.org
> > Cc: 
> > Subject: Re: port-amd64/34550: system clock is drifting when amd64 Cool'n'Quiet is used
> > Date: Mon, 18 Sep 2006 09:41:31 +0200
> > 
> >  You need to select a different timecounter source if you change CPU
> >  frequency (via sysctl).
> 
> the kernel should do it automatically IMO.
>  
>
> 
> the "TSC and Power Management Events on AMD Processors" document could be
> helpful:
> 
> http://lkml.org/lkml/2005/11/4/173
>  
>
Nice read, which comes down to:
    - problems exist
    - it currently does not work reliably (STPCLK)
    - several workarounds for various aspects are known
    - It will be improved

Their recomendation is basically to use another counter or
invest a lot into code coping with the issues.

For now I would go for degrading the TSC quality if
frequency issues can arise until we can safely use TSC
again (The mentioned invariant bit).

As TSC is already initialized very late in the startup sequence we
should extend the "risky" TSC detection hooks to the powernow
framework.

Frank