From owner-freebsd-current@FreeBSD.ORG Thu Apr 10 23:26:17 2008 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from [127.0.0.1] (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by hub.freebsd.org (Postfix) with ESMTP id 176091065675; Thu, 10 Apr 2008 23:26:17 +0000 (UTC) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-current@FreeBSD.org Date: Thu, 10 Apr 2008 19:26:09 -0400 User-Agent: KMail/1.6.2 References: <1248.1207863941@critter.freebsd.dk> <20080410223849.17C278FC24@mx1.freebsd.org> In-Reply-To: <20080410223849.17C278FC24@mx1.freebsd.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200804101926.11343.jkim@FreeBSD.org> Cc: Gary Stanley , Poul-Henning Kamp Subject: Re: TSC Timecounter and multi-core/SMP X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2008 23:26:17 -0000 On Thursday 10 April 2008 06:21 pm, Gary Stanley wrote: > At 05:45 PM 4/10/2008, Poul-Henning Kamp wrote: > >In message <47FE7E0C.4070801@FreeBSD.org>, Maxim Sobolev writes: > > >Kris Kennaway wrote: > > >> gnn@freebsd.org wrote: > > >>> 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. > > >> > > >> Modern Intel systems tend to be synchronized, in my > > >> experience. > > > > > >I really doubt they are. As far as I know newest milti-core > > > chips can modulate frequency of even suspend individual cores > > > independently of each other, which would make such > > > synchronization difficult to maintain if the power management > > > is on. > > > >P4 (and I think most newer chips) have a TSC that runs independent > >of the cpu clock frequency, and supposedly, always at constant > > rate. > > Are you talking about the RDTSCP? I think its only on newer > opterons and phenoms. I think you got it confused with "TscInvariant" feature: http://ltt.polymtl.ca/svn/ltt/branches/poly/doc/developer/tsc.txt "Because using the TSC for fast timer APIs is a desirable feature that helps performance, AMD has defined a CPUID feature bit that software can test to determine if the TSC is invariant. Issuing a CPUID instruction with an %eax register value of 0x8000_0007, on a processor whose base family is 0xF, returns "Advanced Power Management Information" in the %eax, %ebx, %ecx, and %edx registers. Bit 8 of the return %edx is the "TscInvariant" feature flag which is set when TSC is P-state, C-state, and STPCLK-throttling invariant; it is clear otherwise." RDTSCP is not P-state invariant. RDTSCP returns CPU ID with it, nothing more. Even if you have TscInvariant CPUs, I am not sure TSCs between cores/packages are synchronized. Jung-uk Kim