From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 4 17:50:12 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by hub.freebsd.org (Postfix) with ESMTP id 520DAA29; Wed, 4 Jun 2014 17:50:12 +0000 (UTC) Message-ID: <538F5C53.7060208@FreeBSD.org> Date: Wed, 04 Jun 2014 13:50:11 -0400 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Chris Torek Subject: Re: kern.timecounter.smp_tsc_adjust References: <201406041732.s54HWDlE032048@elf.torek.net> In-Reply-To: <201406041732.s54HWDlE032048@elf.torek.net> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Alexander Motin X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jun 2014 17:50:12 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2014-06-04 13:32:13 -0400, Chris Torek wrote: >> In any case, at least one, and maybe two, routines need their >> types changed (and maybe the TSC_READ macro as well). Is it OK >> to just assume the upper 32 bits are in sync? > > For whatever it may be worth, the following patch (to change > everything to 64 bits) is boot-tested and no longer crashes the > system that did crash with the unpatched version. It also > successfully synchronized TSCs at least once (Intel based board > with the "invariant TSC" bit set, 40 CPUs). > > Chris > > x86/tsc: fix SMP TSC adjustment code > > On SMP systems, if kern.timecounter.smp_tsc is set, the kernel > attempts to determine whether the TSCs on the processors are > sufficiently in-sync to be used for time counting. If not, and > kern.timecounter.smp_tsc_adjust is set, we then attempt to adjust > all the TSCs. > > The adjustment code assumed we kept a full 64-bit value for each > TSC, but the data-gathering and comparison code used 32-bit values. > As a result, if the timecounters were out of sync, the adjustment > code could crash (depending on the number of CPUs). > > This converts everything to full 64-bit values. ... It was done on head almost two years ago: http://svnweb.freebsd.org/changeset/base/239133 I guess mav forgot to MFC r239133 before r250772 (CC'ed): http://svnweb.freebsd.org/changeset/base/250772 Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBAgAGBQJTj1xTAAoJEHyflib82/FGhmwH/Rl6DY0mCYSn4IdWKpo+nZ+t SmZzXiItNrwoQrOdYcLp9ocWqvPW3OsCN8sZBEyIpj/WCTkS0gXru6oKN6n0HBjx EQrxI/SH9I/52JgnNZqbVBDS5AqQ0LKbqo6BsZjMl4b4xnHK/8yEKrNJnHRrnL0D 9zF2braQUrMPsIpzYuRB0k8UDWsa++6iAcPY+ovGdDT00WRawSXefChfU1MmTeCN XNiX37hn2t4CKQV1sQVM1hP1D7PSuik5mQq1YX1bZRLkAk8G53U+v1akQ4R+PoK1 569CE/K0KLbwegVtBzSaHMNRhKALweF73yvajSEofEnL76x8QLkeU1Z2d8hP74g= =L9LQ -----END PGP SIGNATURE-----