From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751540AbeABPgh (ORCPT + 1 other); Tue, 2 Jan 2018 10:36:37 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55612 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbeABPgd (ORCPT ); Tue, 2 Jan 2018 10:36:33 -0500 Subject: Re: [PATCH 2/3] x86/tsc: Fix erroneous TSC rate on Skylake Xeon To: Len Brown , x86@kernel.org References: <0fe2503aa7d7fc69137141fc705541a78101d2b9.1513920414.git.len.brown@intel.com> Cc: peterz@infradead.org, linux-kernel@vger.kernel.org, Len Brown , stable@vger.kernel.org From: Prarit Bhargava Message-ID: Date: Tue, 2 Jan 2018 10:36:32 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 02 Jan 2018 15:36:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 12/22/2017 12:27 AM, Len Brown wrote: > From: Len Brown > > Linux-4.9 added INTEL_FAM6_SKYLAKE_X to native_calibrate_tsc(): > > commit 6baf3d61821f > ("x86/tsc: Add additional Intel CPU models to the crystal quirk list") > > There are several problems with doing this. > > The first is that while SKX servers use a 25 MHz crystal, > SKX workstations (with same model #) use a 24 MHz crystal. > This results in a -4.0% time drift rate on SKX workstations. > > While SKX servers do have a 25 MHz crystal, but they too have a problem. > All SKX subject the crystal to an EMI reduction circuit that > reduces its actual frequency by (approximately) -0.25%. > This results in -1 second per 10 minute time drift > as compared to network time. > > This issue can also trigger a timer and power problem, > on configurations that use the LAPIC timer (versus the TSC deadline timer). > Clock ticks scheduled with the LAPIC timer arrive a few usec > before the time they are expected (according to the slow TSC). > This causes Linux to poll-idle, when it should be in an idle > power saving state. The idle and clock code do not graciously > recover from this error, sometimes resulting in significant polling > and measurable power impact. > > So stop using native_calibrate_tsc() for INTEL_FAM6_SKYLAKE_X. > native_calibrate_tsc() will return 0, boot will run with > tsc_khz = cpu_khz, and the TSC refined calibration will > update tsc_khz to correct for the difference. > > This patch restores correctness. Without it, all three of the > issues above occur. > > Signed-off-by: Len Brown > Cc: Prarit Bhargava > Cc: # v4.9+ > --- > arch/x86/kernel/tsc.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > index ce4b71119c36..3bf4df7f52d7 100644 > --- a/arch/x86/kernel/tsc.c > +++ b/arch/x86/kernel/tsc.c > @@ -602,7 +602,6 @@ unsigned long native_calibrate_tsc(void) > case INTEL_FAM6_KABYLAKE_DESKTOP: > crystal_khz = 24000; /* 24.0 MHz */ > break; > - case INTEL_FAM6_SKYLAKE_X: > case INTEL_FAM6_ATOM_DENVERTON: > crystal_khz = 25000; /* 25.0 MHz */ > break; > Sorry, Len I didn't realize you had sent this multiple times. I lifted this code directly from tools/power/x86/turbostat/turbostat.c:4155 -- is that code incorrect too? P.