kernel/time/clocksource.c
Source file repositories/reference/linux-study-clean/kernel/time/clocksource.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/time/clocksource.c- Extension
.c- Size
- 43998 bytes
- Lines
- 1614
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clocksource.hlinux/cpu.hlinux/delay.hlinux/device.hlinux/init.hlinux/kthread.hlinux/module.hlinux/prandom.hlinux/sched.hlinux/tick.hlinux/topology.htick-internal.htimekeeping_internal.h
Detected Declarations
struct watchdog_cpu_datastruct watchdog_dataenum wd_resultfunction cycles_to_nsec_safefunction clocks_calc_mult_shiftfunction clocksource_watchdog_lockfunction clocksource_watchdog_unlockfunction clocksource_watchdog_workfunction clocksource_change_ratingfunction __clocksource_unstablefunction clocksource_watchdog_kthreadfunction clocksource_mark_unstablefunction clocksource_reset_watchdogfunction watchdog_set_resultfunction watchdog_wait_seqfunction watchdog_check_skewfunction watchdog_check_skew_remotefunction wd_csd_lockedfunction wd_get_remote_timeoutfunction __watchdog_check_cpu_skewfunction scoped_guardfunction watchdog_check_cpu_skewfunction watchdog_check_freqfunction scoped_guardfunction clocksource_tick_stablefunction clocksource_enable_highresfunction watchdog_print_freq_timeoutfunction watchdog_print_freq_skewfunction watchdog_handle_remote_timeoutfunction watchdog_print_remote_skewfunction watchdog_check_resultfunction clocksource_watchdogfunction list_for_each_entryfunction clocksource_start_watchdogfunction clocksource_stop_watchdogfunction clocksource_resume_watchdogfunction clocksource_enqueue_watchdogfunction clocksource_select_watchdogfunction list_for_each_entryfunction clocksource_dequeue_watchdogfunction __clocksource_watchdog_kthreadfunction clocksource_watchdog_kthreadfunction clocksource_is_watchdogfunction clocksource_enqueue_watchdogfunction clocksource_select_watchdogfunction clocksource_is_watchdogfunction clocksource_mark_unstablefunction __clocksource_suspend_select
Annotated Snippet
static const struct bus_type clocksource_subsys = {
.name = "clocksource",
.dev_name = "clocksource",
};
static struct device device_clocksource = {
.id = 0,
.bus = &clocksource_subsys,
.groups = clocksource_groups,
};
static int __init init_clocksource_sysfs(void)
{
int error = subsys_system_register(&clocksource_subsys, NULL);
if (!error)
error = device_register(&device_clocksource);
return error;
}
device_initcall(init_clocksource_sysfs);
#endif /* CONFIG_SYSFS */
/**
* boot_override_clocksource - boot clock override
* @str: override name
*
* Takes a clocksource= boot argument and uses it
* as the clocksource override name.
*/
static int __init boot_override_clocksource(char* str)
{
mutex_lock(&clocksource_mutex);
if (str)
strscpy(override_name, str);
mutex_unlock(&clocksource_mutex);
return 1;
}
__setup("clocksource=", boot_override_clocksource);
/**
* boot_override_clock - Compatibility layer for deprecated boot option
* @str: override name
*
* DEPRECATED! Takes a clock= boot argument and uses it
* as the clocksource override name
*/
static int __init boot_override_clock(char* str)
{
if (!strcmp(str, "pmtmr")) {
pr_warn("clock=pmtmr is deprecated - use clocksource=acpi_pm\n");
return boot_override_clocksource("acpi_pm");
}
pr_warn("clock= boot option is deprecated - use clocksource=xyz\n");
return boot_override_clocksource(str);
}
__setup("clock=", boot_override_clock);
Annotation
- Immediate include surface: `linux/clocksource.h`, `linux/cpu.h`, `linux/delay.h`, `linux/device.h`, `linux/init.h`, `linux/kthread.h`, `linux/module.h`, `linux/prandom.h`.
- Detected declarations: `struct watchdog_cpu_data`, `struct watchdog_data`, `enum wd_result`, `function cycles_to_nsec_safe`, `function clocks_calc_mult_shift`, `function clocksource_watchdog_lock`, `function clocksource_watchdog_unlock`, `function clocksource_watchdog_work`, `function clocksource_change_rating`, `function __clocksource_unstable`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.