arch/s390/kernel/time.c
Source file repositories/reference/linux-study-clean/arch/s390/kernel/time.c
File Facts
- System
- Linux kernel
- Corpus path
arch/s390/kernel/time.c- Extension
.c- Size
- 20309 bytes
- Lines
- 834
- Domain
- Architecture Layer
- Bucket
- arch/s390
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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/kernel_stat.hlinux/errno.hlinux/export.hlinux/sched.hlinux/sched/clock.hlinux/kernel.hlinux/param.hlinux/string.hlinux/mm.hlinux/interrupt.hlinux/cpu.hlinux/stop_machine.hlinux/time.hlinux/device.hlinux/delay.hlinux/init.hlinux/smp.hlinux/types.hlinux/profile.hlinux/timex.hlinux/notifier.hlinux/clockchips.hlinux/gfp.hlinux/kprobes.hlinux/uaccess.hvdso/vsyscall.hvdso/clocksource.hvdso/helpers.hasm/facility.hasm/delay.hasm/div64.hasm/vdso.h
Detected Declarations
struct clock_sync_datafunction time_early_initfunction sched_clock_noinstrfunction sched_clockfunction ext_to_timespec64function clock_comparator_workfunction s390_next_eventfunction init_cpu_timerfunction clock_comparator_interruptfunction timing_alert_interruptfunction read_persistent_clock64function read_persistent_wall_and_boot_offsetfunction read_tod_clockfunction clocksource_default_clockfunction time_initfunction get_phys_clockfunction get_phys_clockfunction get_phys_clockfunction check_sync_clockfunction clock_sync_globalfunction clock_sync_localfunction time_init_wqfunction early_parse_stpfunction stp_resetfunction stp_enabledfunction stp_timeoutfunction stp_initfunction stp_timing_alertfunction stp_sync_checkfunction stp_island_checkfunction stp_queue_workfunction __store_stpinfofunction stpinfo_validfunction stp_sync_clockfunction stp_work_fnfunction ctn_id_showfunction ctn_type_showfunction dst_offset_showfunction leap_seconds_showfunction leap_seconds_scheduled_showfunction stratum_showfunction time_offset_showfunction time_zone_offset_showfunction timing_mode_showfunction timing_state_showfunction online_showfunction online_storefunction stp_init_sysfs
Annotated Snippet
static const struct bus_type stp_subsys = {
.name = "stp",
.dev_name = "stp",
};
static ssize_t ctn_id_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t ret = -ENODATA;
mutex_lock(&stp_mutex);
if (stpinfo_valid())
ret = sysfs_emit(buf, "%016lx\n",
*(unsigned long *)stp_info.ctnid);
mutex_unlock(&stp_mutex);
return ret;
}
static DEVICE_ATTR_RO(ctn_id);
static ssize_t ctn_type_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t ret = -ENODATA;
mutex_lock(&stp_mutex);
if (stpinfo_valid())
ret = sysfs_emit(buf, "%i\n", stp_info.ctn);
mutex_unlock(&stp_mutex);
return ret;
}
static DEVICE_ATTR_RO(ctn_type);
static ssize_t dst_offset_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t ret = -ENODATA;
mutex_lock(&stp_mutex);
if (stpinfo_valid() && (stp_info.vbits & 0x2000))
ret = sysfs_emit(buf, "%i\n", (int)(s16)stp_info.dsto);
mutex_unlock(&stp_mutex);
return ret;
}
static DEVICE_ATTR_RO(dst_offset);
static ssize_t leap_seconds_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
ssize_t ret = -ENODATA;
mutex_lock(&stp_mutex);
if (stpinfo_valid() && (stp_info.vbits & 0x8000))
ret = sysfs_emit(buf, "%i\n", (int)(s16)stp_info.leaps);
mutex_unlock(&stp_mutex);
return ret;
}
static DEVICE_ATTR_RO(leap_seconds);
static ssize_t leap_seconds_scheduled_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct stp_stzi stzi;
ssize_t ret;
mutex_lock(&stp_mutex);
if (!stpinfo_valid() || !(stp_info.vbits & 0x8000) || !stp_info.lu) {
mutex_unlock(&stp_mutex);
return -ENODATA;
}
ret = chsc_stzi(stp_page, &stzi, sizeof(stzi));
mutex_unlock(&stp_mutex);
if (ret < 0)
return ret;
if (!stzi.lsoib.p)
return sysfs_emit(buf, "0,0\n");
return sysfs_emit(buf, "%lu,%d\n",
tod_to_ns(stzi.lsoib.nlsout - TOD_UNIX_EPOCH) / NSEC_PER_SEC,
stzi.lsoib.nlso - stzi.lsoib.also);
Annotation
- Immediate include surface: `linux/kernel_stat.h`, `linux/errno.h`, `linux/export.h`, `linux/sched.h`, `linux/sched/clock.h`, `linux/kernel.h`, `linux/param.h`, `linux/string.h`.
- Detected declarations: `struct clock_sync_data`, `function time_early_init`, `function sched_clock_noinstr`, `function sched_clock`, `function ext_to_timespec64`, `function clock_comparator_work`, `function s390_next_event`, `function init_cpu_timer`, `function clock_comparator_interrupt`, `function timing_alert_interrupt`.
- Atlas domain: Architecture Layer / arch/s390.
- 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.