These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / x86 / kernel / tsc_sync.c
index 2648848..78083bf 100644 (file)
@@ -39,16 +39,15 @@ static cycles_t max_warp;
 static int nr_warps;
 
 /*
- * TSC-warp measurement loop running on both CPUs:
+ * TSC-warp measurement loop running on both CPUs.  This is not called
+ * if there is no TSC.
  */
 static void check_tsc_warp(unsigned int timeout)
 {
        cycles_t start, now, prev, end;
        int i;
 
-       rdtsc_barrier();
-       start = get_cycles();
-       rdtsc_barrier();
+       start = rdtsc_ordered();
        /*
         * The measurement runs for 'timeout' msecs:
         */
@@ -63,9 +62,7 @@ static void check_tsc_warp(unsigned int timeout)
                 */
                arch_spin_lock(&sync_lock);
                prev = last_tsc;
-               rdtsc_barrier();
-               now = get_cycles();
-               rdtsc_barrier();
+               now = rdtsc_ordered();
                last_tsc = now;
                arch_spin_unlock(&sync_lock);
 
@@ -113,7 +110,7 @@ static void check_tsc_warp(unsigned int timeout)
  */
 static inline unsigned int loop_timeout(int cpu)
 {
-       return (cpumask_weight(cpu_core_mask(cpu)) > 1) ? 2 : 20;
+       return (cpumask_weight(topology_core_cpumask(cpu)) > 1) ? 2 : 20;
 }
 
 /*
@@ -126,7 +123,7 @@ void check_tsc_sync_source(int cpu)
 
        /*
         * No need to check if we already know that the TSC is not
-        * synchronized:
+        * synchronized or if we have no TSC.
         */
        if (unsynchronized_tsc())
                return;
@@ -190,6 +187,7 @@ void check_tsc_sync_target(void)
 {
        int cpus = 2;
 
+       /* Also aborts if there is no TSC. */
        if (unsynchronized_tsc() || tsc_clocksource_reliable)
                return;