From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754184AbcFPXGP (ORCPT ); Thu, 16 Jun 2016 19:06:15 -0400 Received: from mga11.intel.com ([192.55.52.93]:25736 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbcFPXGO (ORCPT ); Thu, 16 Jun 2016 19:06:14 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,481,1459839600"; d="scan'208";a="829604827" Date: Thu, 16 Jun 2016 16:10:02 -0700 From: Bin Gao To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org Cc: linux-kernel@vger.kernel.org, bin.gao@intel.com Subject: x86/tsc: Set X86_FEATURE_TSC_RELIABLE to skip refined calibration Message-ID: <20160616231002.GA95072@worksta> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unlike PIT based calibration which counts TSC cycles against another timer, MSR or CPUID method has no calibration - it simply multiplies the known frequency of a timer by a ratio. So TSC frequency computed by MSR or CPUID is the final frequency and doesn't need the refined calibration process. We used to use set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE) but it actually doesn't skip refined calibration because the flag is cleared later in identify_cpu(). A cpu caps flag is not cleared only if it's set by setup_force_cpu_cap(). This patch sets the flag in tsc_msr.c and replaces set_cpu_cap() with setup_force_cpu_cap() in other files. Signed-off-by: Bin Gao --- arch/x86/kernel/tsc_msr.c | 2 ++ arch/x86/platform/intel-mid/mfld.c | 2 +- arch/x86/platform/intel-mid/mrfl.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/tsc_msr.c b/arch/x86/kernel/tsc_msr.c index 9911a06..52223aa 100644 --- a/arch/x86/kernel/tsc_msr.c +++ b/arch/x86/kernel/tsc_msr.c @@ -122,6 +122,8 @@ unsigned long try_msr_calibrate_tsc(void) lapic_timer_frequency = (freq * 1000) / HZ; pr_info("lapic_timer_frequency = %d\n", lapic_timer_frequency); #endif + + setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); return res; fail: diff --git a/arch/x86/platform/intel-mid/mfld.c b/arch/x86/platform/intel-mid/mfld.c index 1eb47b6..c75e7a4 100644 --- a/arch/x86/platform/intel-mid/mfld.c +++ b/arch/x86/platform/intel-mid/mfld.c @@ -50,7 +50,7 @@ static unsigned long __init mfld_calibrate_tsc(void) pr_debug("read penwell tsc %lu khz\n", fast_calibrate); lapic_timer_frequency = fsb * 1000 / HZ; /* mark tsc clocksource as reliable */ - set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); + setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); return fast_calibrate; } diff --git a/arch/x86/platform/intel-mid/mrfl.c b/arch/x86/platform/intel-mid/mrfl.c index bd1adc6..aa49531 100644 --- a/arch/x86/platform/intel-mid/mrfl.c +++ b/arch/x86/platform/intel-mid/mrfl.c @@ -79,7 +79,7 @@ static unsigned long __init tangier_calibrate_tsc(void) lapic_timer_frequency); /* mark tsc clocksource as reliable */ - set_cpu_cap(&boot_cpu_data, X86_FEATURE_TSC_RELIABLE); + setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); return fast_calibrate; } -- 1.9.1