Lines Matching defs:clock

15 #include <linux/sched/clock.h>
99 .clock = &dummy_clock, \
185 * clock reference passed to the read function. This can cause crashes if
193 struct clocksource *clock = READ_ONCE(tkr->clock);
195 return clock->read(clock);
204 u64 max_cycles = tk->tkr_mono.clock->max_cycles;
205 const char *name = tk->tkr_mono.clock->name;
208 printk_deferred("WARNING: timekeeping: Cycle offset (%lld) is larger than allowed by the '%s' clock's max_cycles value (%lld): time overflow danger\n",
213 printk_deferred("INFO: timekeeping: Cycle offset (%lld) is larger than the '%s' clock's 50%% safety margin (%lld)\n",
258 max = tkr->clock->max_cycles;
275 delta = tkr->clock->max_cycles;
299 * tk_setup_internals - Set up internals to use clocksource clock.
302 * @clock: Pointer to clocksource.
309 static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
316 old_clock = tk->tkr_mono.clock;
317 tk->tkr_mono.clock = clock;
318 tk->tkr_mono.mask = clock->mask;
321 tk->tkr_raw.clock = clock;
322 tk->tkr_raw.mask = clock->mask;
327 tmp <<= clock->shift;
329 tmp += clock->mult/2;
330 do_div(tmp, clock->mult);
338 tk->xtime_interval = interval * clock->mult;
340 tk->raw_interval = interval * clock->mult;
344 int shift_change = clock->shift - old_clock->shift;
354 tk->tkr_mono.shift = clock->shift;
355 tk->tkr_raw.shift = clock->shift;
358 tk->ntp_error_shift = NTP_SCALE_SHIFT - clock->shift;
364 * to counteract clock drifting.
366 tk->tkr_mono.mult = clock->mult;
367 tk->tkr_raw.mult = clock->mult;
459 * ktime_get_mono_fast_ns - Fast NMI safe access to clock monotonic
497 * ktime_get_raw_fast_ns - Fast NMI safe access to clock monotonic raw
509 * ktime_get_boot_fast_ns - NMI safe and fast access to boot clock.
512 * separate timekeeper with updates to monotonic clock and boot offset
517 * is added to the old timekeeping making the clock appear to update slightly
541 * ktime_get_tai_fast_ns - NMI safe and fast access to tai clock.
577 * ktime_get_real_fast_ns: - NMI safe and fast access to clock realtime.
591 * Stores clock monotonic, boottime and realtime timestamps.
618 * Access to the time keeper clock source is disabled across the innermost
623 * clock, but it might affect some of the nasty low level debug printks.
625 * OTOH, access to sched clock is not guaranteed across suspend/resume on
629 * using sched clock in a similar way as during early boot. But it's not as
631 * against the clock monotonic timestamp jumping backwards on resume.
658 tkr_dummy.clock = &dummy_clock;
664 tkr_dummy.clock = &dummy_clock;
787 * timekeeping_forward_now - update clock to the current time
790 * Forward the current clock to update its state since the last call to
791 * update_wall_time(). This is useful before significant clock changes,
962 * ktime_get_ts64 - get the monotonic clock in timespec64 format
965 * The function calculates the monotonic clock from the realtime
966 * clock and the wall_to_monotonic offset and stores the result
1013 * Returns the wall clock seconds since 1970.
1070 systime_snapshot->cs_id = tk->tkr_mono.clock->id;
1108 * @discontinuity: True indicates clock was set on history period
1241 if (tk->tkr_mono.clock != system_counterval.cs)
1401 * Indicates if there is an offset between the system clock and the hardware
1402 * clock/persistent clock/rtc.
1413 * hard to make the program warp the clock precisely n hours) or
1418 * The best thing to do is to keep the CMOS clock in universal time (UTC)
1474 old = tk->tkr_mono.clock;
1494 * timekeeping_notify - Install a new clock source
1495 * @clock: pointer to the clock source
1497 * This function is called from clocksource.c after a new, better clock
1500 int timekeeping_notify(struct clocksource *clock)
1504 if (tk->tkr_mono.clock == clock)
1506 stop_machine(change_clocksource, clock, NULL);
1508 return tk->tkr_mono.clock == clock ? 0 : -1;
1548 ret = tk->tkr_mono.clock->flags & CLOCK_SOURCE_VALID_FOR_HRES;
1567 ret = tk->tkr_mono.clock->max_idle_ns;
1575 * read_persistent_clock64 - Return time from the persistent clock.
1579 * Reads the time from the battery backed persistent clock.
1591 * read_persistent_wall_and_boot_offset - Read persistent clock, and also offset
1593 * @wall_time: current time as returned by persistent clock
1600 * support dedicated boot time clock will provide the best estimate of the
1626 /* Flag for if there is a persistent clock on this platform */
1636 struct clocksource *clock;
1644 pr_warn("Persistent clock returned invalid value");
1661 clock = clocksource_default_clock();
1662 if (clock->enable)
1663 clock->enable(clock);
1664 tk_setup_internals(tk, clock);
1677 /* time in seconds when suspend began for persistent clock */
1708 * 2) persistent clock (ie: RTC accessible when irqs are off)
1744 * because their RTC/persistent clock is only accessible when irqs are enabled.
1780 struct clocksource *clock = tk->tkr_mono.clock;
1797 * used: Nonstop clocksource during suspend, persistent clock and rtc
1802 * suspend-nonstop clocksource -> persistent clock -> rtc
1807 nsec = clocksource_stop_suspend_timing(clock, cycle_now);
1870 curr_clock = tk->tkr_mono.clock;
1962 * Now, even though we're adjusting the clock frequency, we have
2019 * If the clock is behind the NTP time, increase the multiplier by 1
2021 * tick division, the clock will slow down. Otherwise it will stay
2029 if (unlikely(tk->tkr_mono.clock->maxadj &&
2030 (abs(tk->tkr_mono.mult - tk->tkr_mono.clock->mult)
2031 > tk->tkr_mono.clock->maxadj))) {
2034 tk->tkr_mono.clock->name, (long)tk->tkr_mono.mult,
2035 (long)tk->tkr_mono.clock->mult + tk->tkr_mono.clock->maxadj);
2138 /* Accumulate error between NTP and clock interval */
2243 * basically means that however wrong your real time clock is at boot time,
2297 * @cwsseq: pointer to check and store the clock was set sequence number
2300 * @offs_tai: pointer to storage for monotonic -> clock tai offset
2405 * random_get_entropy_fallback - Returns the raw clock source value,
2411 struct clocksource *clock = READ_ONCE(tkr->clock);
2413 if (unlikely(timekeeping_suspended || !clock))
2415 return clock->read(clock);