From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 4 18:56:50 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 903218FD; Wed, 4 Jun 2014 18:56:50 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 04DA923FC; Wed, 4 Jun 2014 18:56:49 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n15so2042801wiw.8 for ; Wed, 04 Jun 2014 11:56:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=gxJZR/Iti0oi8rQeX5KKTQ0DYD1WABDQYi6N16lPEqo=; b=avfIu82/QFlI05jbu4GcAyM4xHxQ2goEkRwehel+V/z9tRDp82/ETv3qJWExh4L8x/ CoFtv7MKxjHn6krpUhW99jK56GVlbMWZZuNBrxdzGtV2N5/J0+ix9IhR8Mis1Rf41/8h pLHmyzfx68C7dZddzwnRs1nT9R7aAzTBR5fdsXZaNfBmpzB5qQmzccH/tFXyliw6PFJ/ wKc23yiKp4Tvg6PUmEP8tONsoIZvfcUyKq4Su6qjmGwWIbol9Jw2uz588pUXeF+7iz8Z yeItz4FSvMx6ey3teyEMOsBrTP9mpUW2QghGiLGhk+/aLzAS+esAToV25Mi9ruzk/ccn PHsA== X-Received: by 10.15.26.135 with SMTP id n7mr3140406eeu.71.1401908206290; Wed, 04 Jun 2014 11:56:46 -0700 (PDT) Received: from mavbook.mavhome.dp.ua ([134.249.139.101]) by mx.google.com with ESMTPSA id i2sm7888541eem.11.2014.06.04.11.56.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Jun 2014 11:56:45 -0700 (PDT) Sender: Alexander Motin Message-ID: <538F6BEC.6070300@FreeBSD.org> Date: Wed, 04 Jun 2014 21:56:44 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Jung-uk Kim , Chris Torek Subject: Re: kern.timecounter.smp_tsc_adjust References: <201406041732.s54HWDlE032048@elf.torek.net> <538F5C53.7060208@FreeBSD.org> In-Reply-To: <538F5C53.7060208@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org 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 18:56:50 -0000 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