From owner-freebsd-hackers@FreeBSD.ORG Tue Apr 16 22:04:45 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 27E2D9B6 for ; Tue, 16 Apr 2013 22:04:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-ea0-x236.google.com (mail-ea0-x236.google.com [IPv6:2a00:1450:4013:c01::236]) by mx1.freebsd.org (Postfix) with ESMTP id BD93B1AF7 for ; Tue, 16 Apr 2013 22:04:44 +0000 (UTC) Received: by mail-ea0-f182.google.com with SMTP id q15so460903ead.41 for ; Tue, 16 Apr 2013 15:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=JvQiIC98EoeWDPQME84XQFXY4bjvOwpFKKRJ6LZ16KM=; b=JCYuN7Vvb/j7i34RUppG4hl0teJdULimAdR0WNBeupKLt1gdGdhJ3z+8LKbOU6mdzq PSEy7pEAPSWw3Y9upKPeRfvj5AgfIVD6w1eZhz9LXqdmW2J0Ds1L3unFmg4ueg/qzNPT UqAOWZUFgiDz0zUyV4yH/ZjymkGMPb0F2WoS12i87u9tA4BZXBw6RqfyBVl7S0bptsLA 31esnAcJ4U9JM9sC0HqLwo3AP49eqBt72qcVg5NTRxAkivzjByefjAAOOk5XxHv+0Xoi YQpvSq5pcD/Ujj7w967iFbf8zeKJprvM32FvUZgU6/f0PgWfM2M9bwmTWLxzOkvzmBa7 RfDw== X-Received: by 10.14.182.72 with SMTP id n48mr11091388eem.3.1366149883888; Tue, 16 Apr 2013 15:04:43 -0700 (PDT) Received: from mavbook.mavhome.dp.ua (mavhome.mavhome.dp.ua. [213.227.240.37]) by mx.google.com with ESMTPS id s47sm5133559eeg.8.2013.04.16.15.04.41 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Apr 2013 15:04:42 -0700 (PDT) Sender: Alexander Motin Message-ID: <516DCAF7.20400@FreeBSD.org> Date: Wed, 17 Apr 2013 01:04:39 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130413 Thunderbird/17.0.5 MIME-Version: 1.0 To: freebsd-hackers@FreeBSD.org Subject: Synchronizing TSC Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2013 22:04:45 -0000 Hi. Recently I've got 6-core/12-thread system on Sandy Bridge-E Core i7-3930K CPU and was unpleasantly surprised to see that TSCs are not synchronized there. While all 11 APs were synchronized, BSP was far behind them. Since it is single-socket system, I don't know any good reason for such behavior except some BIOS bug. But I've recalled that somewhere was some discussions about possible TSC synchronization. I've implemented patch below that allows to adjust TSC values of BSPs to AP's one on boot using CPU MSRs, hoping that they should not diverge after that: http://people.freebsd.org/~mav/tsc_adj2.patch I don't know very much about all different TSC hardware to predict when it is safe to enable the functionality, but at least on my system being enabled via loader tunable it seems working well. Comments? -- Alexander Motin