If the TSC has already been determined to be unstable, then checking
TSC ADJUST values is a waste of time and generates unnecessary error
messages.

Signed-off-by: Mike Travis <mike.tra...@hpe.com>
Reviewed-by: Dimitri Sivanich <dimitri.sivan...@hpe.com>
Reviewed-by: Russ Anderson <russ.ander...@hpe.com>
Reviewed-by: Peter Zijlstra <pet...@infradead.org>
---
v2: Add check_tsc_unstable to !CONFIG_SMP case.
    Patches merged against 4.14.0-rc4
---
 arch/x86/kernel/tsc_sync.c |    8 ++++++++
 1 file changed, 8 insertions(+)

--- linux.orig/arch/x86/kernel/tsc_sync.c
+++ linux/arch/x86/kernel/tsc_sync.c
@@ -52,6 +52,10 @@ void tsc_verify_tsc_adjust(bool resume)
        if (!boot_cpu_has(X86_FEATURE_TSC_ADJUST))
                return;
 
+       /* Skip unnecessary error messages if TSC already unstable */
+       if (check_tsc_unstable())
+               return;
+
        /* Rate limit the MSR check */
        if (!resume && time_before(jiffies, adj->nextcheck))
                return;
@@ -114,6 +118,10 @@ bool __init tsc_store_and_check_tsc_adju
        if (!boot_cpu_has(X86_FEATURE_TSC_ADJUST))
                return false;
 
+       /* Skip unnecessary error messages if TSC already unstable */
+       if (check_tsc_unstable())
+               return false;
+
        rdmsrl(MSR_IA32_TSC_ADJUST, bootval);
        cur->bootval = bootval;
        cur->nextcheck = jiffies + HZ;

-- 

Reply via email to