Lines Matching +full:powered +full:- +full:while +full:- +full:suspended
61 * ------------------------------------------------
63 * The Pentium family, like many chip architectures, has a high-resolution
77 * While TSC and %tick are both cycle counting registers, TSC's functionality
80 * (a) TSCs on different CPUs are not guaranteed to be in sync. While in
85 * only supports writing the low 32-bits of TSC, making it impractical
92 * TSCs and account for it (it is assumed that while there may exist skew,
94 * have newly onlined CPUs call tsc_sync_slave(), while the CPU performing
97 * In the absence of time-of-day clock adjustments, gethrtime() must stay in
99 * cannot drive its time-of-day source from TSC, and yet they must somehow be
101 * is called once per second from the interrupt which drives time-of-day.
115 * compiler to emit code that "optimized" away the while-loops below. The
139 (hrt) += mul32(_l[0], scale) >> (32 - NSEC_SHIFT); \
145 (hrt) += mul32(_l[0], scale) >> (32 - NSEC_SHIFT); \
217 tsc -= tsc_last; in tsc_gethrtime()
218 } else if (tsc >= tsc_last - 2*tsc_max_delta) { in tsc_gethrtime()
245 } while ((old_hres_lock & ~1) != hres_lock); in tsc_gethrtime()
271 tsc = tsc_read() + tsc_sync_tick_delta[CPU->cpu_id]; in tsc_gethrtime_delta()
277 tsc -= tsc_last; in tsc_gethrtime_delta()
278 } else if (tsc >= tsc_last - 2 * tsc_max_delta) { in tsc_gethrtime_delta()
287 } while ((old_hres_lock & ~1) != hres_lock); in tsc_gethrtime_delta()
299 hrt = tsc_sync_tick_delta[CPU->cpu_id]; in tsc_gethrtime_tick_delta()
305 /* Calculate the hrtime while exposing the parameters of that calculation. */
319 tsc = tsc_read() + tsc_sync_tick_delta[CPU->cpu_id]; in tsc_gethrtime_params()
329 } while ((old_hres_lock & ~1) != hres_lock); in tsc_gethrtime_params()
333 tsc -= last; in tsc_gethrtime_params()
334 } else if (tsc >= last - 2 * tsc_max_delta) { in tsc_gethrtime_params()
384 tsc += tsc_sync_tick_delta[CPU->cpu_id]; in dtrace_gethrtime()
392 tsc -= tsc_last; in dtrace_gethrtime()
393 else if (tsc >= tsc_last - 2*tsc_max_delta) in dtrace_gethrtime()
406 * If we're here, the clock lock is locked -- or it has been in dtrace_gethrtime()
408 * tsc_tick() running on another CPU -- or it may be because in dtrace_gethrtime()
433 tsc += tsc_sync_tick_delta[CPU->cpu_id]; in dtrace_gethrtime()
441 tsc -= shadow_tsc_last; in dtrace_gethrtime()
442 else if (tsc >= shadow_tsc_last - 2 * tsc_max_delta) in dtrace_gethrtime()
450 } while ((old_hres_lock & ~1) != shadow_hres_lock); in dtrace_gethrtime()
466 } while ((old_hres_lock & ~1) != hres_lock); in tsc_gethrtimeunscaled()
517 hrt = tsc_gethrtimeunscaled() + tsc_sync_tick_delta[CPU->cpu_id]; in tsc_gethrtimeunscaled_delta()
534 * TSC while reading a global variable updated by the master CPU. The latest
539 * While the delay between cache line invalidation on the slave and mfence
543 * such as bus contention. Each sample set is independent per-CPU to control
567 source = CPU->cpu_id; in tsc_sync_master()
570 while (tsc_sync_go != TSC_SYNC_GO) in tsc_sync_master()
573 tsc->master_tsc = tsc_read(); in tsc_sync_master()
576 while (tsc_sync_go != TSC_SYNC_DONE) in tsc_sync_master()
578 write_time = mtsc_after - tsc->master_tsc; in tsc_sync_master()
582 tdelta = tsc->slave_tsc - mtsc_after; in tsc_sync_master()
584 tdelta = -tdelta; in tsc_sync_master()
592 tdelta = tsc->slave_tsc - in tsc_sync_master()
593 (mtsc_after - (write_time/4)); in tsc_sync_master()
595 tdelta = tsc->slave_tsc - mtsc_after; in tsc_sync_master()
597 last_delta = tsc_sync_tick_delta[source] - tdelta; in tsc_sync_master()
602 tsc->master_tsc = tsc->slave_tsc = write_time = 0; in tsc_sync_master()
611 last_delta = (last_delta < 0) ? -last_delta : last_delta; in tsc_sync_master()
644 /* Re-fill the cache line */ in tsc_sync_slave()
645 s1 = tsc->master_tsc; in tsc_sync_slave()
651 * slave are the same hyper-threaded CPU, we want the in tsc_sync_slave()
655 } while (tsc->master_tsc == 0); in tsc_sync_slave()
656 tsc->slave_tsc = s1; in tsc_sync_slave()
660 while (tsc_sync_go != TSC_SYNC_STOP) in tsc_sync_slave()
669 * CY_HIGH_LEVEL interrupt. (No longer just cpu0-only)
696 now += tsc_sync_tick_delta[CPU->cpu_id]; in tsc_tick()
716 delta = now - tsc_last; in tsc_tick()
741 (uint_t)(((uint64_t)NANOSEC << (32 - NSEC_SHIFT)) / cpu_freq_hz); in tsc_hrtimeinit()
743 (uint_t)(((uint64_t)cpu_freq_hz << (32 - NSEC_SHIFT)) / NANOSEC); in tsc_hrtimeinit()
748 tsc_max_delta = tsc_read() - tsc; in tsc_hrtimeinit()
759 * ignore the absent delta data while the TSCs are synced. in tsc_hrtimeinit()
803 * Functions to manage TSC and high-res time on suspend and resume.
818 * Take snapshots of the current time and do any other pre-suspend work.
824 * We need to collect the time at which we suspended here so we know in tsc_suspend()
883 sleep_sec = ts.tv_sec - tsc_saved_ts.tv_sec; in tsc_resume()
895 /* How many TSC's should have occured while sleeping */ in tsc_resume()
907 * never powered off, then: in tsc_resume()
911 sleep_tsc -= now; in tsc_resume()
935 if (l->tscc_preference > r->tscc_preference) in tsc_calibrate_cmp()
936 return (-1); in tsc_calibrate_cmp()
937 if (l->tscc_preference < r->tscc_preference) in tsc_calibrate_cmp()
941 int c = strcmp(l->tscc_source, r->tscc_source); in tsc_calibrate_cmp()
944 return (-1); in tsc_calibrate_cmp()
962 if (strcasecmp(source, tsccp->tscc_source) == 0) in tsc_calibrate_get_force()
1000 * we don't care about the results or saving the result -- tscc_pit.c in tsc_pit_also()
1003 (void) pit->tscc_calibrate(&dummy); in tsc_pit_also()
1015 * only support 64-bit x86 systems, there should always be a TSC in tsc_calibrate()
1062 PRM_DEBUGS(force->tscc_source); in tsc_calibrate()
1064 if (!force->tscc_calibrate(&tsc_freq)) in tsc_calibrate()
1088 * While we could sort the set contents in place, we'll make a copy in tsc_calibrate()
1103 PRM_DEBUGS(tsccpp[i]->tscc_source); in tsc_calibrate()
1104 if (tsccpp[i]->tscc_calibrate(&tsc_freq)) { in tsc_calibrate()
1109 tsccpp[i]->tscc_source, tsc_freq / 1000000); in tsc_calibrate()
1129 * In case it's useful, we don't free tsccpp -- we're about to panic in tsc_calibrate()