Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Apr 2008 17:32:03 -0700
From:      "David O'Brien" <obrien@freebsd.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        gnn@freebsd.org, freebsd-current@freebsd.org
Subject:   Re: TSC Timecounter and multi-core/SMP
Message-ID:  <20080418003203.GB11705@dragon.NUXI.org>
In-Reply-To: <18431.23276.913397.188219@grasshopper.cs.duke.edu>
References:  <m2d4oy8n30.wl%gnn@neville-neil.com> <18431.23276.913397.188219@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 11, 2008 at 08:34:29AM -0400, Andrew Gallatin wrote:
> gnn@freebsd.org writes:
>  > Howdy,
>  > 
>  > Is the TSC timecounter synchronized across multiple cores and/or
>  > processors?  A quick search seems to indicate it's not but I'd like to
>  > find a definitive reference on the TSC.
> 
> There is a great comment in the OpenSolaris source code talking about
> TSCs and their behavior on SMP systems.  See
> http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/i86pc/os/timestamp.c
> 
> FWIW, solaris manages to keep track of unsynchronized TSCs, and use
> unsynchronized TSC timecounters for timekeeping on SMP systems.  It
> would be nice if FreeBSD could do the same.

This only works for systems with an invariant TSC.  That is Solaris keeps
a per-CPU(core) TSC delta that is applied when the TSC is read from that
CPU(core).  I agree this would be a nice feature to have.  Linux sorely
needs it too.

This breaks down if the TSC's are not P-state invariant.  Which is why
Solaris does not support PowerNow! on K8's.  But running K8's at their
max speed, Solaris achieves an invariant TSC.

AMD processors make no guarantees about TSC values being synced across
processors (or Cores of a processor).  This is true for K7, K8, and
Greyhound (Family 10h).

The TSC on K8 is not invariant - its rate of change is affected by
P-state changes.

The TSC on Greyhound (Family 10h) is invariant.
[but as stated above, is not synced with other cores]

-- 
-- David  (obrien@FreeBSD.org)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080418003203.GB11705>