Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2004 13:38:37 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        Andrew Gallatin <gallatin@cs.duke.edu>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: Is the TSC timecounter safe on SMP system?
Message-ID:  <200408131338.37038.jhb@FreeBSD.org>
In-Reply-To: <16668.64083.212658.727644@grasshopper.cs.duke.edu>
References:  <16668.61707.474283.639200@grasshopper.cs.duke.edu> <200408131326.16412.jhb@FreeBSD.org> <16668.64083.212658.727644@grasshopper.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 13 August 2004 01:28 pm, Andrew Gallatin wrote:
> John Baldwin writes:
>  > On Friday 13 August 2004 12:49 pm, Andrew Gallatin wrote:
>  > > I have a system where the TSC timecounter is quite a bit more accurate
>  > > (or perhaps its just much cheaper) than the ACPI timecounter.  This is
>  > > a single CPU, HTT system running an SMP kernel.
>  > >
>  > > A simple program which calls gettimeofday() in a tight loop, looking
>  > > for the microseconds to change sees ~998,000 microsecond updates/sec
>  > > with kern.timecounter.hardware=TSC, and 28,500 updates/sec with
>  > > ACPI-safe.
>  > >
>  > > 1) Is it safe to switch to TSC?
>  > >
>  > > 2) If yes, would it be safe to switch to TSC if this was a real
>  > >    SMP system with multiple physical cpus?
>  >
>  > Probably not.  The problem is that the TSC is not necessarily in sync
>  > between the CPUs so time would "jump around" as you migrated between
>  > CPUs.  If you can get the TSC's synchronized between the CPUs and keep
>  > them that way then you can use the TSC (Linux does this FWIW).
>
> But on a single CPU HTT machine, does each HTT core reads the same TSC?

I think they each have their own TSC.

-- 
John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



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