From nobody Fri Dec 19 17:16:24 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9113526FA50; Mon, 19 May 2025 08:33:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747643611; cv=none; b=Uu5ozdwgsDAx1FtEpJFED7kkBCm5kwQhA0JOM2ism7sn7TtbV+m5U4sbQLHz42sXo+L2qFdtOcOKZPlcqEf8liS1chPESJwWcXGwgcXFNd9rEPxqmx/VrGf9CEaKBZ2f57yqZfAzK1BQ2FVmFtpFU6vsaZv31aUTpXCgWoXaomI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747643611; c=relaxed/simple; bh=v2CnstdLIXMf6usycAYVnie0z2f9rUAXKX2icLofJLY=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=o4Q9l8lhHBMaYn2VSkSuSw02+JzCEjaf+i9I/EfR1dl8ILFAmM4Kka31d3/rmZ4NhwZVZzHFwvSw6677f54X6sdMuWXU/XIJEWSAOldpvk9I9kkgHcfb/miDZGDezJfWwN6vt5D7F06so2HDx65yPILJYGA42KCyRuJcjvEWxGM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lQ8VNKyO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=KVNm7qRF; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lQ8VNKyO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="KVNm7qRF" Message-ID: <20250519083026.287145536@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1747643607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=KU3LaI1wfhZWx046ayWmUOBaJZ+N4sC2ljBYeM/Rzlk=; b=lQ8VNKyOx9Nyv/C0fuO+6qs24jw7XNfMURf6YaKmKPhFmVvUhfVfVuZ96H3/0KtRNEqoyj lHNufJfcfulrYM1oNxW9ql05gaXlMHrXM0I1U2qwjmQcDt6sr+74CHtXkOXnredgn+j8PN 7IVo02PyYUtSzPcVybBKlOvoPmij0/Kr5qfcnJJolV2F9rs/L9++rT4uH3w5tr8fQidVgf rBQDz30Z/L6J/b4d7SD0uSA0aZiNRYJ1MDXonXyK9+kInVTrZ76ZtwkcFVB7qpxG2I4Kq7 1N7oytuaWLWl/YEw+Ja6pS0axaBJmzbRQ8P737t6hF5XGZ7FrRYsqTdaGvyrIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1747643607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=KU3LaI1wfhZWx046ayWmUOBaJZ+N4sC2ljBYeM/Rzlk=; b=KVNm7qRF+fM81O67uDIUxjCJD1LhOL5OMe6Vw3XVNMKRayg47o8SLvlAExb2hvrPOMtAGN sIaaNX4CbVHajSCw== From: Thomas Gleixner To: LKML Cc: netdev@vger.kernel.org, Richard Cochran , Christopher Hall , John Stultz , Frederic Weisbecker , Anna-Maria Behnsen , Miroslav Lichvar , Werner Abt , David Woodhouse , Stephen Boyd , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Kurt Kanzenbach , Nam Cao , Antoine Tenart Subject: [patch V2 11/26] timekeeping: Add clock_valid flag to timekeeper References: <20250519082042.742926976@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Mon, 19 May 2025 10:33:27 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner 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 Acked-by: John Stultz --- include/linux/timekeeper_internal.h | 2 ++ kernel/time/timekeeping.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) --- --- a/include/linux/timekeeper_internal.h +++ b/include/linux/timekeeper_internal.h @@ -73,6 +73,7 @@ struct tk_read_base { * @raw_sec: CLOCK_MONOTONIC_RAW time in seconds * @clock_was_set_seq: The sequence number of clock was set events * @cs_was_changed_seq: The sequence number of clocksource change events + * @clock_valid: Indicator for valid clock * @monotonic_to_boot: CLOCK_MONOTONIC to CLOCK_BOOTTIME offset * @cycle_interval: Number of clock cycles in one NTP interval * @xtime_interval: Number of clock shifted nano seconds in one NTP @@ -149,6 +150,7 @@ struct timekeeper { /* Cachline 3 and 4 (timekeeping internal variables): */ unsigned int clock_was_set_seq; u8 cs_was_changed_seq; + u8 clock_valid; =20 struct timespec64 monotonic_to_boot; =20 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1665,11 +1665,12 @@ read_persistent_wall_and_boot_offset(str *boot_offset =3D ns_to_timespec64(local_clock()); } =20 -static __init void tkd_basic_setup(struct tk_data *tkd, enum timekeeper_id= s tk_id) +static __init void tkd_basic_setup(struct tk_data *tkd, enum timekeeper_id= s tk_id, bool valid) { raw_spin_lock_init(&tkd->lock); seqcount_raw_spinlock_init(&tkd->seq, &tkd->lock); tkd->timekeeper.id =3D tkd->shadow_timekeeper.id =3D tk_id; + tkd->timekeeper.clock_valid =3D tkd->shadow_timekeeper.clock_valid =3D va= lid; } =20 /* @@ -1699,7 +1700,7 @@ void __init timekeeping_init(void) struct timekeeper *tks =3D &tk_core.shadow_timekeeper; struct clocksource *clock; =20 - tkd_basic_setup(&tk_core, TIMEKEEPER_CORE); + tkd_basic_setup(&tk_core, TIMEKEEPER_CORE, true); =20 read_persistent_wall_and_boot_offset(&wall_time, &boot_offset); if (timespec64_valid_settod(&wall_time) &&