Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Jun 2014 21:56:44 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        Jung-uk Kim <jkim@FreeBSD.org>, Chris Torek <torek@torek.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: kern.timecounter.smp_tsc_adjust
Message-ID:  <538F6BEC.6070300@FreeBSD.org>
In-Reply-To: <538F5C53.7060208@FreeBSD.org>
References:  <201406041732.s54HWDlE032048@elf.torek.net> <538F5C53.7060208@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04.06.2014 20:50, Jung-uk Kim wrote:
> 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

Merged to stable/9. Thanks for the reminder.

-- 
Alexander Motin



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