Lines Matching full:clocksource

3  * This file contains the functions which manage clocksource drivers.
11 #include <linux/clocksource.h>
23 static void clocksource_enqueue(struct clocksource *cs);
25 static noinline u64 cycles_to_nsec_safe(struct clocksource *cs, u64 start, u64 end) in cycles_to_nsec_safe()
90 /*[Clocksource internal variables]---------
92 * currently selected clocksource.
100 * Name of the user-specified clocksource.
102 static struct clocksource *curr_clocksource;
103 static struct clocksource *suspend_clocksource;
123 * clocksource surrounding a read of the clocksource being validated.
128 * If a clocksource is good enough for NTP, it is good enough for us!
130 * In other words, by default, even if a clocksource is extremely
132 * permissible skew between the clocksource watchdog and the clocksource
157 static struct clocksource *watchdog;
195 static void clocksource_change_rating(struct clocksource *cs, int rating) in clocksource_change_rating()
202 static void __clocksource_unstable(struct clocksource *cs) in __clocksource_unstable()
208 * If the clocksource is registered clocksource_watchdog_kthread() will in __clocksource_unstable()
225 * clocksource_mark_unstable - mark clocksource unstable via watchdog
226 * @cs: clocksource to be marked unstable
231 void clocksource_mark_unstable(struct clocksource *cs) in clocksource_mark_unstable()
253 static enum wd_read_status cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow) in cs_watchdog_read()
281 * significant delay in reading both clocksource and watchdog. in cs_watchdog_read()
359 struct clocksource *cs = (struct clocksource *)csin; in clocksource_verify_one_cpu()
364 void clocksource_verify_percpu(struct clocksource *cs) in clocksource_verify_percpu()
381 pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name); in clocksource_verify_percpu()
385 pr_info("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n", in clocksource_verify_percpu()
410 pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n", in clocksource_verify_percpu()
413 pr_warn(" CPUs %*pbl behind CPU %d for clocksource %s.\n", in clocksource_verify_percpu()
416 pr_warn(" CPU %d check durations %lldns - %lldns for clocksource %s.\n", in clocksource_verify_percpu()
423 struct clocksource *cs; in clocksource_reset_watchdog()
435 struct clocksource *cs; in clocksource_watchdog()
448 /* Clocksource already marked unstable? */ in clocksource_watchdog()
466 * watchdog/clocksource is very big, and affect the accuracy of in clocksource_watchdog()
481 /* Clocksource initialized ? */ in clocksource_watchdog()
521 /* Check the deviation from the watchdog clocksource. */ in clocksource_watchdog()
528 …pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is t… in clocksource_watchdog()
536 …pr_warn(" Clocksource '%s' skewed %lld ns (%lld ms) over watchdog '%s' interv… in clocksource_watchdog()
539 pr_warn(" '%s' is current clocksource.\n", cs->name); in clocksource_watchdog()
541 …pr_warn(" '%s' (not '%s') is current clocksource.\n", curr_clocksource->name,… in clocksource_watchdog()
543 pr_warn(" No current clocksource.\n"); in clocksource_watchdog()
565 * If this is not the current clocksource let in clocksource_watchdog()
567 * change to high res this clocksource might in clocksource_watchdog()
569 * clocksource let the tick code know about in clocksource_watchdog()
631 static void clocksource_enqueue_watchdog(struct clocksource *cs) in clocksource_enqueue_watchdog()
636 /* cs is a clocksource to be watched. */ in clocksource_enqueue_watchdog()
648 struct clocksource *cs, *old_wd; in clocksource_select_watchdog()
658 /* cs is a clocksource to be watched. */ in clocksource_select_watchdog()
683 static void clocksource_dequeue_watchdog(struct clocksource *cs) in clocksource_dequeue_watchdog()
687 /* cs is a watched clocksource. */ in clocksource_dequeue_watchdog()
697 struct clocksource *cs, *tmp; in __clocksource_watchdog_kthread()
735 static bool clocksource_is_watchdog(struct clocksource *cs) in clocksource_is_watchdog()
742 static void clocksource_enqueue_watchdog(struct clocksource *cs) in clocksource_enqueue_watchdog()
749 static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } in clocksource_dequeue_watchdog()
752 static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } in clocksource_is_watchdog()
753 void clocksource_mark_unstable(struct clocksource *cs) { } in clocksource_mark_unstable()
760 static bool clocksource_is_suspend(struct clocksource *cs) in clocksource_is_suspend()
765 static void __clocksource_suspend_select(struct clocksource *cs) in __clocksource_suspend_select()
768 * Skip the clocksource which will be stopped in suspend state. in __clocksource_suspend_select()
774 * The nonstop clocksource can be selected as the suspend clocksource to in __clocksource_suspend_select()
776 * interfaces to suspend the nonstop clocksource when system suspends. in __clocksource_suspend_select()
779 pr_warn("Nonstop clocksource %s should not supply suspend/resume interfaces\n", in __clocksource_suspend_select()
789 * clocksource_suspend_select - Select the best clocksource for suspend timing
790 * @fallback: if select a fallback clocksource
794 struct clocksource *cs, *old_suspend; in clocksource_suspend_select()
811 * @cs: current clocksource from timekeeping
820 * clocksource mutex.
822 void clocksource_start_suspend_timing(struct clocksource *cs, u64 start_cycles) in clocksource_start_suspend_timing()
828 * If current clocksource is the suspend timer, we should use the in clocksource_start_suspend_timing()
839 pr_warn_once("Failed to enable the non-suspend-able clocksource.\n"); in clocksource_start_suspend_timing()
848 * @cs: current clocksource from timekeeping
853 * Returns nanoseconds since suspend started, 0 if no usable suspend clocksource.
858 * taking the clocksource mutex.
860 u64 clocksource_stop_suspend_timing(struct clocksource *cs, u64 cycle_now) in clocksource_stop_suspend_timing()
868 * If current clocksource is the suspend timer, we should use the in clocksource_stop_suspend_timing()
881 * Disable the suspend timer to save power if current clocksource is in clocksource_stop_suspend_timing()
891 * clocksource_suspend - suspend the clocksource(s)
895 struct clocksource *cs; in clocksource_suspend()
903 * clocksource_resume - resume the clocksource(s)
907 struct clocksource *cs; in clocksource_resume()
930 * @cs: Pointer to clocksource
933 static u32 clocksource_max_adjustment(struct clocksource *cs) in clocksource_max_adjustment()
971 * The actual maximum number of cycles we can defer the clocksource is in clocks_calc_max_nsecs()
990 * clocksource_update_max_deferment - Updates the clocksource max_idle_ns & max_cycles
991 * @cs: Pointer to clocksource to be updated
994 static inline void clocksource_update_max_deferment(struct clocksource *cs) in clocksource_update_max_deferment()
1010 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur) in clocksource_find_best()
1012 struct clocksource *cs; in clocksource_find_best()
1018 * We pick the clocksource with the highest rating. If oneshot in clocksource_find_best()
1019 * mode is active, we pick the highres valid clocksource with in clocksource_find_best()
1035 struct clocksource *best, *cs; in __clocksource_select()
1037 /* Find the best suitable clocksource */ in __clocksource_select()
1045 /* Check for the override clocksource. */ in __clocksource_select()
1053 * capable clocksource if the tick code is in oneshot in __clocksource_select()
1057 /* Override clocksource cannot be used. */ in __clocksource_select()
1059 …pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/N… in __clocksource_select()
1067 pr_info("Override clocksource %s is not currently HRT compatible - deferring\n", in __clocksource_select()
1071 /* Override clocksource can be used. */ in __clocksource_select()
1078 pr_info("Switched to clocksource %s\n", best->name); in __clocksource_select()
1084 * clocksource_select - Select the best clocksource available
1088 * Select the clocksource with the best rating, or the clocksource,
1104 * Hack to avoid lots of clocksource churn at boot time.
1124 * Enqueue the clocksource sorted by rating
1126 static void clocksource_enqueue(struct clocksource *cs) in clocksource_enqueue()
1129 struct clocksource *tmp; in clocksource_enqueue()
1141 * __clocksource_update_freq_scale - Used update clocksource with new freq
1142 * @cs: clocksource to be registered
1143 * @scale: Scale factor multiplied against freq to get clocksource hz
1144 * @freq: clocksource frequency (cycles per second) divided by scale
1146 * This should only be called from the clocksource->enable() method.
1152 void __clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq) in __clocksource_update_freq_scale()
1167 * clocksource with mask >= 40-bit and f >= 4GHz. That maps to in __clocksource_update_freq_scale()
1193 * watchdog clocksource and the clocksource under test will be at in __clocksource_update_freq_scale()
1223 "timekeeping: Clocksource %s might overflow on 11%% adjustment\n", in __clocksource_update_freq_scale()
1235 * @cs: clocksource to be registered
1236 * @scale: Scale factor multiplied against freq to get clocksource hz
1237 * @freq: clocksource frequency (cycles per second) divided by scale
1244 int __clocksource_register_scale(struct clocksource *cs, u32 scale, u32 freq) in __clocksource_register_scale()
1254 pr_warn("clocksource %s registered with invalid VDSO mode %d. Disabling VDSO support.\n", in __clocksource_register_scale()
1262 /* Add clocksource to the clocksource list */ in __clocksource_register_scale()
1279 * Unbind clocksource @cs. Called with clocksource_mutex held
1281 static int clocksource_unbind(struct clocksource *cs) in clocksource_unbind()
1301 * Select and try to install a replacement suspend clocksource. in clocksource_unbind()
1302 * If no replacement suspend clocksource, we will just let the in clocksource_unbind()
1303 * clocksource go and have no suspend clocksource. in clocksource_unbind()
1317 * clocksource_unregister - remove a registered clocksource
1318 * @cs: clocksource to be unregistered
1320 int clocksource_unregister(struct clocksource *cs) in clocksource_unregister()
1334 * current_clocksource_show - sysfs interface for current clocksource
1337 * @buf: char buffer to be filled with clocksource list
1339 * Provides sysfs interface for listing current clocksource.
1372 * current_clocksource_store - interface for manually overriding clocksource
1375 * @buf: name of override clocksource
1379 * clocksource selection.
1400 * unbind_clocksource_store - interface for manually unbinding clocksource
1406 * Takes input from sysfs interface for manually unbinding a clocksource.
1412 struct clocksource *cs; in unbind_clocksource_store()
1435 * available_clocksource_show - sysfs interface for listing clocksource
1438 * @buf: char buffer to be filled with clocksource list
1446 struct clocksource *src; in available_clocksource_show()
1452 * Don't show non-HRES clocksource if the tick code is in available_clocksource_show()
1476 ATTRIBUTE_GROUPS(clocksource);
1479 .name = "clocksource",
1480 .dev_name = "clocksource",
1506 * Takes a clocksource= boot argument and uses it
1507 * as the clocksource override name.
1518 __setup("clocksource=", boot_override_clocksource);
1525 * as the clocksource override name
1530 pr_warn("clock=pmtmr is deprecated - use clocksource=acpi_pm\n"); in boot_override_clock()
1533 pr_warn("clock= boot option is deprecated - use clocksource=xyz\n"); in boot_override_clock()