From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751349AbdLVF2F (ORCPT ); Fri, 22 Dec 2017 00:28:05 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44959 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750786AbdLVF2D (ORCPT ); Fri, 22 Dec 2017 00:28:03 -0500 X-Google-Smtp-Source: ACJfBott0cY/ih+lFHKwE/Oi1l+U6xzP8qHQeZMhkiIJSw6FSZa3LQfCaIv7lDmtn9BiFsATFh5clg== From: Len Brown To: x86@kernel.org Cc: peterz@infradead.org, linux-kernel@vger.kernel.org, Len Brown , Bin Gao , stable@vger.kernel.org Subject: [PATCH 1/3] x86/tsc: Future-proof native_calibrate_tsc() Date: Fri, 22 Dec 2017 00:27:54 -0500 Message-Id: <0fe2503aa7d7fc69137141fc705541a78101d2b9.1513920414.git.len.brown@intel.com> X-Mailer: git-send-email 2.14.0-rc0 Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Len Brown If native_calibrate_tsc() can not discover the TSC frequency, via CPUID or via built-in table, it must return without setting X86_FEATURE_TSC_KNOWN_FREQ. Otherwise, X86_FEATURE_TSC_KNOWN_FREQ will prevent TSC refined calibration. This patch allows Linux to correctly support future Intel hardware, that has (cpu_khz != tsc_khz), and support for CPUID.15 without support for CPUID.15.crystal_khz. This patch is needed since X86_FEATURE_TSC_KNOWN_FREQ was added in Linux-4.10: commit 4ca4df0b7eb0 ("x86/tsc: Mark TSC frequency determined by CPUID as known") If not applied, such systems will run with tsc_khz = cpu_khz, which may result in under-stated TSC rate, and time-of-day drift. Signed-off-by: Len Brown Cc: Bin Gao Cc: # v4.10+ --- arch/x86/kernel/tsc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 8ea117f8142e..ce4b71119c36 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -612,6 +612,8 @@ unsigned long native_calibrate_tsc(void) } } + if (crystal_khz == 0) + return 0; /* * TSC frequency determined by CPUID is a "hardware reported" * frequency and is the most accurate one so far we have. This -- 2.14.0-rc0