From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 3 20:59:32 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 1FC16489 for ; Tue, 3 Jun 2014 20:59:32 +0000 (UTC) Received: from elf.torek.net (50-73-42-1-utah.hfc.comcastbusiness.net [50.73.42.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6D8F29E4 for ; Tue, 3 Jun 2014 20:59:31 +0000 (UTC) Received: from elf.torek.net (localhost [127.0.0.1]) by elf.torek.net (8.14.5/8.14.5) with ESMTP id s53Kv2YT016755 for ; Tue, 3 Jun 2014 14:57:02 -0600 (MDT) (envelope-from torek@torek.net) Message-Id: <201406032057.s53Kv2YT016755@elf.torek.net> From: Chris Torek To: freebsd-hackers@freebsd.org Subject: kern.timecounter.smp_tsc_adjust Date: Tue, 03 Jun 2014 14:57:02 -0600 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (elf.torek.net [127.0.0.1]); Tue, 03 Jun 2014 14:57:02 -0600 (MDT) 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: Tue, 03 Jun 2014 20:59:32 -0000 In x86/x86/tsc.c we have several routines for checking the TSCs across multiple CPUs in an SMP system, and then optionally adjusting them. We tried turning on the adjustment option and the system promptly crashed. This appears to be the culprit: static int test_tsc(void) { uint32_t *data, *tsc; (note the type of "*data") static void comp_smp_tsc(void *arg) { uint32_t *tsc; (again, uint32_t), but: static void adj_smp_tsc(void *arg) { uint64_t *tsc; The TSC_READ code uses rdtsc32(), so the types are more or less correct there, but maybe everyone should just use 64 bits throughout, and rdtsc()? 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? Chris