Lines Matching +full:needs +full:- +full:reset +full:- +full:on +full:- +full:resume
1 // SPDX-License-Identifier: GPL-2.0
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.
37 * TSC's on different sockets may be reset asynchronously.
38 * This may cause the TSC ADJUST value on socket 0 to be NOT 0.
50 void tsc_verify_tsc_adjust(bool resume) in tsc_verify_tsc_adjust() argument
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()
89 * is always on.
131 * On the boot cpu we just force set the ADJUST value to 0 if it's in tsc_sanitize_first_cpu()
132 * non zero. We don't do that on non boot cpus because physical in tsc_sanitize_first_cpu()
138 * when multiple sockets are reset asynchronously with each other in tsc_sanitize_first_cpu()
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()
206 * where TSC_ADJUST is expected to be different. When called on the in tsc_store_and_check_tsc_adjust()
223 if (bootval != ref->bootval) in tsc_store_and_check_tsc_adjust()
228 * value on this newly upcoming CPU differs from the adjustment 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()
237 * We have the TSCs forced to be in sync on this package. Skip sync 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
281 * previous TSC that was measured (possibly on in check_tsc_warp()
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).
334 * Ideally we should be able to skip the TSC sync check on the other
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
339 * cores in the socket don't get reset at the same time.
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()
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()
449 * is true for SoCs which have no fallback clocksource. On these in check_tsc_sync_target()
487 * Reset it for the next sync test: in check_tsc_sync_target()
502 * needs to move backwards. in check_tsc_sync_target()
505 cur_max_warp = -gbl_max_warp; in check_tsc_sync_target()
512 * really depends on CPU, node distance and frequency. So in check_tsc_sync_target()
515 * value is used. In the worst case the adjustment needs to go 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()