x86/tsc: Move sync cleanup to a safe place
authorThomas Gleixner <tglx@linutronix.de>
Sat, 19 Nov 2016 13:47:40 +0000 (13:47 +0000)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 29 Nov 2016 18:23:18 +0000 (19:23 +0100)
Cleaning up the stop marker on the control CPU is wrong when we want to add
retry support. Move the cleanup to the starting CPU.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Link: http://lkml.kernel.org/r/20161119134017.892095627@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/tsc_sync.c

index fdb3b7befc47e51992a04069bcffedc310619ed3..8f394eeb936eb124fea96eff9d749e32fcb7b277 100644 (file)
@@ -266,11 +266,6 @@ void check_tsc_sync_source(int cpu)
                return;
        }
 
-       /*
-        * Reset it - in case this is a second bootup:
-        */
-       atomic_set(&stop_count, 0);
-
        /*
         * Wait for the target to start or to skip the test:
         */
@@ -360,6 +355,11 @@ void check_tsc_sync_target(void)
         */
        while (atomic_read(&stop_count) != cpus)
                cpu_relax();
+
+       /*
+        * Reset it for the next sync test:
+        */
+       atomic_set(&stop_count, 0);
 }
 
 #endif /* CONFIG_SMP */