From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 3 06:03:59 2011 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C6B6106564A; Fri, 3 Jun 2011 06:03:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 851C68FC15; Fri, 3 Jun 2011 06:03:58 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA07176; Fri, 03 Jun 2011 09:03:56 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1QSNUC-0000bw-HZ; Fri, 03 Jun 2011 09:03:56 +0300 Message-ID: <4DE8794B.60100@FreeBSD.org> Date: Fri, 03 Jun 2011 09:03:55 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.17) Gecko/20110503 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Jung-uk Kim References: <201105241356.45543.jkim@FreeBSD.org> <201105311616.31256.jkim@FreeBSD.org> <4DE5D0D1.1030903@FreeBSD.org> <201106011655.51233.jkim@FreeBSD.org> In-Reply-To: <201106011655.51233.jkim@FreeBSD.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org Subject: Re: [RFC] Enabling invariant TSC timecounter on SMP X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jun 2011 06:03:59 -0000 on 01/06/2011 23:55 Jung-uk Kim said the following: > Yes, it's still a work-in-progress. However, I thought it is good > enough for 9.0 inclusion. BTW, the latest patch is here: > > http://people.freebsd.org/~jkim/tsc_smp_test5.diff > > FYI, the only meaningful change from the previous version is that it's > limited to AMD single-socket Bulldozer platforms and Intel Core and > later platforms. We may add more quirks if needed, of course. Looks good, but I think that the check is a little bit unfair to AMD Family 10h+ CPUs. Although TSCs in those CPUs are per core I've never seen them drift out of sync if they started with the same value. [snip] > Consecutive RDTSCs used on a same CPU is always incremental but we > cannot 100% guarantee that on two cores, even if TSC is derived from > the same clock. I am hoping at least latency difference (I believe > it's about few tens of cycles max) is "eaten up" by lowering > resolution. It's not perfect but it's better than serialization > (Linux) or heuristics (OpenSolaris), just because there are few rare > conditions to consider. Thoughts? I am still not sure which case this code should solve. Thread T1: x1 = rdtsc() on CPU1; Thread T1: x2 = rdtsc() on CPU2; x2 < x1 ? Or? -- Andriy Gapon