Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timekeeping: Add clock_valid flag to timekeeper

In preparation for supporting independent auxiliary timekeepers, add a
clock valid field and set it to true for the system timekeeper.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20250519083026.287145536@linutronix.de


+5 -2
+2
include/linux/timekeeper_internal.h
··· 73 73 * @raw_sec: CLOCK_MONOTONIC_RAW time in seconds 74 74 * @clock_was_set_seq: The sequence number of clock was set events 75 75 * @cs_was_changed_seq: The sequence number of clocksource change events 76 + * @clock_valid: Indicator for valid clock 76 77 * @monotonic_to_boot: CLOCK_MONOTONIC to CLOCK_BOOTTIME offset 77 78 * @cycle_interval: Number of clock cycles in one NTP interval 78 79 * @xtime_interval: Number of clock shifted nano seconds in one NTP ··· 150 149 /* Cachline 3 and 4 (timekeeping internal variables): */ 151 150 unsigned int clock_was_set_seq; 152 151 u8 cs_was_changed_seq; 152 + u8 clock_valid; 153 153 154 154 struct timespec64 monotonic_to_boot; 155 155
+3 -2
kernel/time/timekeeping.c
··· 1665 1665 *boot_offset = ns_to_timespec64(local_clock()); 1666 1666 } 1667 1667 1668 - static __init void tkd_basic_setup(struct tk_data *tkd, enum timekeeper_ids tk_id) 1668 + static __init void tkd_basic_setup(struct tk_data *tkd, enum timekeeper_ids tk_id, bool valid) 1669 1669 { 1670 1670 raw_spin_lock_init(&tkd->lock); 1671 1671 seqcount_raw_spinlock_init(&tkd->seq, &tkd->lock); 1672 1672 tkd->timekeeper.id = tkd->shadow_timekeeper.id = tk_id; 1673 + tkd->timekeeper.clock_valid = tkd->shadow_timekeeper.clock_valid = valid; 1673 1674 } 1674 1675 1675 1676 /* ··· 1700 1699 struct timekeeper *tks = &tk_core.shadow_timekeeper; 1701 1700 struct clocksource *clock; 1702 1701 1703 - tkd_basic_setup(&tk_core, TIMEKEEPER_CORE); 1702 + tkd_basic_setup(&tk_core, TIMEKEEPER_CORE, true); 1704 1703 1705 1704 read_persistent_wall_and_boot_offset(&wall_time, &boot_offset); 1706 1705 if (timespec64_valid_settod(&wall_time) &&