Lines Matching +full:- +full:- +full:retry +full:- +full:all +full:- +full:errors

1 // SPDX-License-Identifier: GPL-2.0
7 * We check whether all boot CPUs have their TSC's synchronized,
8 * print a warning if not and turn off the TSC clock-source.
10 * The warp-check is point-to-point between two CPUs, the CPU
14 * Only two CPUs may participate - they can enter in any order.
63 if (!resume && time_before(jiffies, adj->nextcheck)) in tsc_verify_tsc_adjust()
66 adj->nextcheck = jiffies + HZ; in tsc_verify_tsc_adjust()
69 if (adj->adjusted == curval) in tsc_verify_tsc_adjust()
73 wrmsrl(MSR_IA32_TSC_ADJUST, adj->adjusted); in tsc_verify_tsc_adjust()
75 if (!adj->warned || resume) { in tsc_verify_tsc_adjust()
76 pr_warn(FW_BUG "TSC ADJUST differs: CPU%u %lld --> %lld. Restoring\n", in tsc_verify_tsc_adjust()
77 smp_processor_id(), adj->adjusted, curval); in tsc_verify_tsc_adjust()
78 adj->warned = true; in tsc_verify_tsc_adjust()
100 /* Run the check for all onlined CPUs in turn */ in tsc_sync_check_timer_fn()
152 cur->adjusted = bootval; in tsc_sanitize_first_cpu()
169 cur->bootval = bootval; in tsc_store_and_check_tsc_adjust()
170 cur->nextcheck = jiffies + HZ; in tsc_store_and_check_tsc_adjust()
191 cur->bootval = bootval; in tsc_store_and_check_tsc_adjust()
192 cur->nextcheck = jiffies + HZ; in tsc_store_and_check_tsc_adjust()
193 cur->warned = false; in tsc_store_and_check_tsc_adjust()
196 * If a non-zero TSC value for socket 0 may be valid then the default in tsc_store_and_check_tsc_adjust()
200 cur->adjusted = bootval; in tsc_store_and_check_tsc_adjust()
223 if (bootval != ref->bootval) in tsc_store_and_check_tsc_adjust()
224 printk_once(FW_BUG "TSC ADJUST differs within socket(s), fixing all errors\n"); in tsc_store_and_check_tsc_adjust()
232 if (bootval != ref->adjusted) { in tsc_store_and_check_tsc_adjust()
233 cur->adjusted = ref->adjusted; in tsc_store_and_check_tsc_adjust()
234 wrmsrl(MSR_IA32_TSC_ADJUST, ref->adjusted); in tsc_store_and_check_tsc_adjust()
253 * we want to have the fastest, inlined, non-debug version
254 * of a critical section, to be able to prove TSC time-warps:
264 * TSC-warp measurement loop running on both CPUs. This is not called
304 * we saw a time-warp of the TSC going backwards: in check_tsc_warp()
308 max_warp = max(max_warp, prev - now); in check_tsc_warp()
321 WARN(!(now-start), in check_tsc_warp()
323 now-start, end-start); in check_tsc_warp()
328 * If the target CPU coming online doesn't have any of its core-siblings
329 * online, a timeout of 20msec will be used for the TSC-warp measurement
332 * have more and more logical-siblings in that socket).
335 * core-siblings, if the first logical CPU in a socket passed the sync test.
336 * But as the TSC is per-logical CPU and can potentially be modified wrongly
338 * to catch such errors. Also this will catch the condition where all the
370 retry: in check_tsc_sync_source()
372 while (atomic_read(&start_count) != cpus - 1) in check_tsc_sync_source()
382 while (atomic_read(&stop_count) != cpus-1) in check_tsc_sync_source()
388 * retry. In case of random warps no retry is attempted. in check_tsc_sync_source()
393 pr_debug("TSC synchronization [CPU#%d -> CPU#%u]: passed\n", in check_tsc_sync_source()
400 pr_warn("TSC synchronization [CPU#%d -> CPU#%u]:\n", in check_tsc_sync_source()
410 * Reset it - just in case we boot another CPU later: in check_tsc_sync_source()
424 * Retry, if there is a chance to do so. in check_tsc_sync_source()
427 goto retry; in check_tsc_sync_source()
459 retry: in check_tsc_sync_target()
471 * Store the maximum observed warp value for a potential retry: in check_tsc_sync_target()
493 * failed and a retry with adjusted TSC is possible. If zero the in check_tsc_sync_target()
505 cur_max_warp = -gbl_max_warp; in check_tsc_sync_target()
518 cur->adjusted += cur_max_warp; in check_tsc_sync_target()
521 cpu, cur_max_warp, cur->adjusted); in check_tsc_sync_target()
523 wrmsrl(MSR_IA32_TSC_ADJUST, cur->adjusted); in check_tsc_sync_target()
524 goto retry; in check_tsc_sync_target()