From nobody Tue Sep 29 04:13:33 2026 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 8D54D46F481 for ; Wed, 12 Aug 2026 15:17:50 +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=1786547872; cv=none; b=fB8KPN1LIUuCSBGrtd0kA3vqE9Fz3/eHTZuP170yZyRbPkSYHoTVkZdinli72zI2Eg7KbbyCbY9XdeC8bCvyE5tijiT/AXayHlsJJTOkPe+V3CaERl5bvD5oCmCFlt/Gzo/D1fY9m9Ge18rbHLcwwz/UM7x+MQMxydiuD2FGPrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786547872; c=relaxed/simple; bh=Cm91XuXYWfNnvS/8fx/3tsiF7VRLMNJTj+Jt+78NjxM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bW21FUAUhGcc16+/pdFhaJ8jgIg+dKUp6vMqqzsAxZE3jgHJjK1D+3nAtLt1ePwvyNy7WzE5ojmO8jo4KxDXfA+NEyHEUW2iJuHGrTGa6kK7Kn6AkZ1dwqTRQh+IMZzvsioirpe4r0qgFRr19SsnPhRKhj12xV+hGS30gF5nX+Q= 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=EmYMn2mw; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=dnbCud7A; 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="EmYMn2mw"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dnbCud7A" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786547868; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CgRIzYoWduk04DnK+ru3ecoCYccONvLtK/rvWyN3WV0=; b=EmYMn2mwmlCPgPbRpAkdfGGlPXNUlJS8qKAjhuVoOHxKXldkiWVQCC1BKOv2siHPnXeh9w Q6u+/VFYrZu2RSkFpu7vUMCp7beRlWmlkrT9/+4KXitdV4J59uuk/pztb4GJzi9xxR36vI o0jvlPJkw5XUtL6aWoTBvKaO2WHv3BgqqOIdCzR4JT9yP5diKZ01mNAewzA2gREfedhSnq QdOvn3oIueVoE2l2JjUAlyI2inoVuTbCcztBzaxRhgR4d4Y2Q29TzmL/bQ/yAk7nZUO0QZ 7HracoV8ERt4AuHqhnNOhKqDxItCAKMoVh5cdDtT9zs6OB55jzgxL3JznpH1eQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786547868; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CgRIzYoWduk04DnK+ru3ecoCYccONvLtK/rvWyN3WV0=; b=dnbCud7AisOGou5St+u11/vD25l4gT70tBIq5VwMwSURgQyS5PmLKoO9sKRQxsan09F6HP sQa2rGu8YE0/U3AA== Date: Wed, 12 Aug 2026 17:17:45 +0200 Subject: [PATCH 1/4] timekeeping: Move timekeeper_is_core_tk() up in the file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-timekeeping-conditionals-v1-1-75ebe366677d@linutronix.de> References: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> In-Reply-To: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> To: John Stultz , Thomas Gleixner , Stephen Boyd , Miroslav Lichvar Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1786547866; l=1284; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=Cm91XuXYWfNnvS/8fx/3tsiF7VRLMNJTj+Jt+78NjxM=; b=FQt2NlP07j9kdt53EiVb6NYyfQBlsAL9knFfSjHqPMHIusKyuvJ5WgrWcekt3/ffrL1ftVDgD dzwIo3e4vSwCTxymtxG2Ll89/MzOXuD6ZNufh6LutTqiAlnP1kG6BLU X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= New users are about to be introduced which require the definition earlier in the file. Move it. Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) --- kernel/time/timekeeping.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ea2e6e55f37b..2249d7fb3cb6 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -90,6 +90,11 @@ static inline void tk_update_aux_offs(struct timekeeper = *tk, ktime_t offs) tk->monotonic_to_aux =3D ktime_to_timespec64(offs); } =20 +static inline bool timekeeper_is_core_tk(struct timekeeper *tk) +{ + return !IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS) || tk->id =3D=3D TIMEKEEPER_C= ORE; +} + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; =20 @@ -1735,11 +1740,6 @@ int do_settimeofday64(const struct timespec64 *ts) } EXPORT_SYMBOL(do_settimeofday64); =20 -static inline bool timekeeper_is_core_tk(struct timekeeper *tk) -{ - return !IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS) || tk->id =3D=3D TIMEKEEPER_C= ORE; -} - /** * __timekeeping_inject_offset - Adds or subtracts from the current time. * @tkd: Pointer to the timekeeper to modify --=20 2.55.0 From nobody Tue Sep 29 04:13:33 2026 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 1F9E9470439 for ; Wed, 12 Aug 2026 15:17:51 +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=1786547872; cv=none; b=Zn1PBh2dJbuHmkud8dcIWYVw7e36YNKzxFgOTU9lzmgWANNjoJA4ne2lrBqj32bplUp9Rs4aAS9WFgFxRQIZsmohGYsXsXFYzx1E+VO4mARmb3fqi6qeQnHtrNaDsFVuF1iq0ztprvNeMd9seNPBj9Von8y43MxQFdaoReXBaOI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786547872; c=relaxed/simple; bh=SHa7MhiH4KffXnv8vcKF3Xh1XMKP8VpWfvBOySk+YGM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dNDzeZpKw8XIAvNjH/nmRPjIWVyFVcg1YoY3hXpCJOdfjP+WMypeUBvAw7eIKg/nYxTexE0n1/fgqNYSavHJVBh7Ipd8tL8CaIwJPfdJaX8PXiaDN6SAl5LnnwoXkVNlnx6W19C9I9upp4EWC2erOaFdJbdoby8poi9KME9tD4w= 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=rZDN0uAE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0GiTm+JR; 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="rZDN0uAE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0GiTm+JR" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786547869; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mmUPyPwhOCilctbfm0dnkCpPOce7cqhzRfMvgs++v/o=; b=rZDN0uAE+N2KOoyIkCVz9sxL+TzSWs7/SE+tgQ6P/qA3BBeiwI9NM/Km6iJ0R6VIIatpqo RHX0Ff9fRRkjtwXRdzx1r2zUPYnK0Cm4rre0hQeIDxVwIVXN7ZMmKt9jQ+dpTJ1VD1Z3Pl B91yiQugUwkmc3kE4h5m583AIlxMgamFrJv049TvbBUDyJgumwnfBQXvFsK3ugNaWGlDND B8enzXMYr2x83VSMz3G4X0mX8KaY6Y9cnuNwqwPYToQQQaBqybyFyiKdBT5vq8RfyLUK2S ggdRz0tiGIv+cX30kYyZS/n9s+Rynb3DmcVneUuV/eVW8xKHF6PVkRJMdMVVUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786547869; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mmUPyPwhOCilctbfm0dnkCpPOce7cqhzRfMvgs++v/o=; b=0GiTm+JRN+H+EOJBSlthnRC7ao5jvaCgU6UwHRc705aaZhGSVCRPloxSjXwogzw7bMTcUH J3zKdhV68PEyjGBQ== Date: Wed, 12 Aug 2026 17:17:46 +0200 Subject: [PATCH 2/4] timekeeping: Use timekeeper_is_core_tk() in timekeeping_update_on_shadow() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-timekeeping-conditionals-v1-2-75ebe366677d@linutronix.de> References: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> In-Reply-To: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> To: John Stultz , Thomas Gleixner , Stephen Boyd , Miroslav Lichvar Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1786547866; l=929; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=SHa7MhiH4KffXnv8vcKF3Xh1XMKP8VpWfvBOySk+YGM=; b=lI7PG+d4bH/yj6Bs1qoF4TfFHqC06WBlNGx3Hx3oLMVueG9hOh4XwUvOQHpv/y6vy3GJtRsWe pby7pqh/JUCBiH4tbdLuS1pgnk3TYLUir/OlYifOiaPZGBlyFpDTUif X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= If CONFIG_POSIX_AUX_CLOCKS is disabled, the timekeeper is known to be the core timekeeper. Use the helper to avoid the conditional at runtime in this case. Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) --- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 2249d7fb3cb6..12bd61e9b5de 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -842,7 +842,7 @@ static void timekeeping_update_from_shadow(struct tk_da= ta *tkd, unsigned int act tk_update_ktime_data(tk); tk->tkr_mono.base_real =3D tk->tkr_mono.base + tk->offs_real; =20 - if (tk->id =3D=3D TIMEKEEPER_CORE) { + if (timekeeper_is_core_tk(tk)) { tk_update_ns_to_cyc(tk, &tkd->timekeeper); update_vsyscall(tk); update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); --=20 2.55.0 From nobody Tue Sep 29 04:13:33 2026 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 91D6E32ED4E for ; Wed, 12 Aug 2026 15:17:51 +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=1786547873; cv=none; b=HiL3XCgrIF0jUzL82hLboLYEwzvxujWvfQh2ndX81Mkwz5c3MwKFA/zvw943vuUSBf3TB2cbL/Wk+wD2gB0YjhT00+/6QV7Q9xQWMA+NQwNJprv0qHoWGoKPNTzwA0JV2RGg3kx/jdbiR6mExqTCM7+olyR5O3mQu343cU68htw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786547873; c=relaxed/simple; bh=0mF3ZSgls4zxtkywuY/G/YHlHZNhj+aK/fZo0n1LSKY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OAXqbD86cy7dSbT8xJBZzvhIFmOMMSRteVMaw0JAUdNxQ2hZXtx4bGxUfulDW/xQqCNXQeJZO0VDm5FB3mWAzI3SMEP0SdCLNVUj+E9p7Flummuh9OTNv5gxucQ7QAdYQq/FKHjr9/Ze3BwE/SlEpFaR4Oi2Z2goQxqso6SmtDY= 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=GzKJSCQp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lKrrTWmj; 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="GzKJSCQp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lKrrTWmj" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786547870; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ZISxLtvrHQGEx+ZHSlk4XusC6V+9UtAas6lks1KQ5Y=; b=GzKJSCQpMNxdxmOgPc+PaGESDU5c56tIBAnoqmNJIfW8TKm5dsDIF+R7fFasSVyi6aQlWG 3R/bnui0J4AVyYQJXxPa2FV9QWokKnYSFINt95csiRO7XkqgIdpm/JIclbuYyYH+lqhpOR vKLOuzRSi6kdSP3BIJ7fBg6LgYrypLSfuJFU1TZGghdgdCtTf86Uh5W6bnUJwzjSGFSQUU EL+/sOK4P6d1F6Ynh3hxK/twuAjiQvXzKtT9AfetNkOFi4P0Oy93w/5SKhlNQI2mEb66Gv I9GYaAs7L32voDhMGCe5eJOUCLLb+pahEbMP/s0w5vv+xUqq8BJA9HP3BTc5Vw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786547870; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ZISxLtvrHQGEx+ZHSlk4XusC6V+9UtAas6lks1KQ5Y=; b=lKrrTWmjVi7T69gBJTenWhBZ0gI3Skk+KhgMs/Gw3rueAFIZOuzK2aS+Y2a415ecOrcZCP MGvdz1DkVLICCNBQ== Date: Wed, 12 Aug 2026 17:17:47 +0200 Subject: [PATCH 3/4] timekeeping: Remove tk_is_aux() and its usage Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-timekeeping-conditionals-v1-3-75ebe366677d@linutronix.de> References: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> In-Reply-To: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> To: John Stultz , Thomas Gleixner , Stephen Boyd , Miroslav Lichvar Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1786547866; l=1552; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=0mF3ZSgls4zxtkywuY/G/YHlHZNhj+aK/fZo0n1LSKY=; b=QT6i/SI7v53KN2YcLctstWp1NU2bKhcBi8yyUeGgg5CrEJL3hMSnnCEqv3y6YIhsizO0WNWw8 BIpgqrD17jhCzbIprmXc5wQJHOi6oX3sljj5pEsnq68wzxFpdGV8rYI X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Any timekeeper which is not the core timekeeper is already known to be an auxiliary one. There is no need for an additional conditional. Remove the 'else if' and the now unused tk_is_aux(). Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) --- kernel/time/timekeeping.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 12bd61e9b5de..5cdf6795c5a6 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -62,22 +62,12 @@ static inline bool tk_get_aux_ts64(unsigned int tkid, s= truct timespec64 *ts) { return ktime_get_aux_ts64(CLOCK_AUX + tkid - TIMEKEEPER_AUX_FIRST, ts); } - -static inline bool tk_is_aux(const struct timekeeper *tk) -{ - return tk->id >=3D TIMEKEEPER_AUX_FIRST && tk->id <=3D TIMEKEEPER_AUX_LAS= T; -} static inline struct tk_data *aux_get_tk_data(clockid_t id); #else static inline bool tk_get_aux_ts64(unsigned int tkid, struct timespec64 *t= s) { return false; } - -static inline bool tk_is_aux(const struct timekeeper *tk) -{ - return false; -} static inline struct tk_data *aux_get_tk_data(clockid_t id) { return NULL; @@ -849,7 +839,7 @@ static void timekeeping_update_from_shadow(struct tk_da= ta *tkd, unsigned int act =20 update_fast_timekeeper(&tk->tkr_mono, &tk_fast_mono); update_fast_timekeeper(&tk->tkr_raw, &tk_fast_raw); - } else if (tk_is_aux(tk)) { + } else { vdso_time_update_aux(tk); } =20 --=20 2.55.0 From nobody Tue Sep 29 04:13:33 2026 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 360B8470446 for ; Wed, 12 Aug 2026 15:17:52 +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=1786547873; cv=none; b=Dmrm2lWfzHK2bWCQfh89Cz0qQTiZKLYSuegaasW1qv4pCsLERVhW8THpKeipkG8mkAO4VdgMDurmDJ8GbaCuDvxAO0CiJbYsLzUxTjbsww+Ckyl7w6ip6cFWvbwy+hnK1XDSuiZkGUS9L5A3M0PjUJwYLr9K5TdFfw04mByLy4A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786547873; c=relaxed/simple; bh=dzGDbhhGi+3uNCM/afFVfLO4nDm3ep+Nmd9v2t11Drs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GwjNPkBhmDhwaZ4FsU3LvyIlnYaWzkyJYooYiwD80EKj5/7kAWTYbdneY6mLXB6tDp6ELmDVnjjFHeyThTZcOrZaIR5POFwGvzL0HC/jpD43QAjNYDhx25dCS/lvpIKQ4UVMJQNM1N7X3NuIlSJ/4iQeoKyQrOHcmjjDTItIlhY= 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=nn3lAVY5; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fl5foDy3; 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="nn3lAVY5"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fl5foDy3" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786547870; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e1NDuFDOTkBJEA7mk1+wwH7al0YDr8s3damloONjuog=; b=nn3lAVY5MiRYzGKefs2u1RIewvPSoeuRrurVAkuyVhms6yjLUAnaXXzWuuZw8pBxszOcVS Lk3pznPvZ0aH+SebZXXmY+1o8IqIdayQQlPj46qK6oSFjNlE/BHku6CWGw5lPCZHgI95CB Y11RvxkWGuXKE4zXz21TvIM6Mj16z2HzfBO5GSbdydSKxQyd01hr98BV9f45YcaCp3ymoY GbkCQYPFEkwW6ERQsO+CMWfGVJ6AAOpUi4JxdPf10b/pmqodyY1h3HXJV8AorPhWHyrxM2 ZO7Uj+a5sRE7IPKML7PG9o6MeWLeAPmH0gxVhvoL295OeLOATuRRDNmlK4bPYw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786547870; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e1NDuFDOTkBJEA7mk1+wwH7al0YDr8s3damloONjuog=; b=fl5foDy3V2jnJeb2KWpwpLW+IGokllFRY7JsADhsKh1Hj/odxCgQ4syoWQnz0MJp0PjYYc 54dZ5f3W+KKtBNBA== Date: Wed, 12 Aug 2026 17:17:48 +0200 Subject: [PATCH 4/4] timekeeping: Introduce and use timekeeper_is_clock_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260812-timekeeping-conditionals-v1-4-75ebe366677d@linutronix.de> References: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> In-Reply-To: <20260812-timekeeping-conditionals-v1-0-75ebe366677d@linutronix.de> To: John Stultz , Thomas Gleixner , Stephen Boyd , Miroslav Lichvar Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh_=28Schneider_Electric=29?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1786547866; l=2859; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=dzGDbhhGi+3uNCM/afFVfLO4nDm3ep+Nmd9v2t11Drs=; b=wzHpVgP+3S3JFiAN5obPfGX52Vqf7MowPZmU+52ImvEIf+KTKm1viNBtQ7ZdDiiFzJAT1XTxK H3785OG6ra6BdP2b4gG9T4GtSsDfPo5xmAWswSXYjxTNPeVSYG8PEnF X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= If CONFIG_POSIX_AUX_CLOCKS is disabled only the core timekeeper exists which is always valid. Introduce and use a helper function to avoid the runtime conditional in this case. Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) --- kernel/time/timekeeping.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 5cdf6795c5a6..8a8cb9f9f333 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -85,6 +85,11 @@ static inline bool timekeeper_is_core_tk(struct timekeep= er *tk) return !IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS) || tk->id =3D=3D TIMEKEEPER_C= ORE; } =20 +static inline bool timekeeper_is_clock_valid(const struct timekeeper *tk) +{ + return !IS_ENABLED(CONFIG_POSIX_AUX_CLOCKS) || tk->clock_valid; +} + /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; =20 @@ -1292,7 +1297,7 @@ void ktime_get_snapshot_id(clockid_t clock_id, struct= system_time_snapshot *syst seq =3D read_seqcount_begin(&tkd->seq); =20 /* Aux clocks can be invalid */ - if (!tk->clock_valid) + if (!timekeeper_is_clock_valid(tk)) return; =20 now =3D tk_clock_read_snapshot(&tk->tkr_mono, &chs); @@ -2993,7 +2998,7 @@ static int __do_adjtimex(struct tk_data *tkd, struct = __kernel_timex *txc, =20 guard(raw_spinlock_irqsave)(&tkd->lock); =20 - if (!tks->clock_valid) + if (!timekeeper_is_clock_valid(tks)) return -ENODEV; =20 if (txc->modes & ADJ_SETOFFSET) { @@ -3108,7 +3113,7 @@ static void tk_aux_update_clocksource(void) struct timekeeper *tks =3D &tkd->shadow_timekeeper; =20 guard(raw_spinlock_irqsave)(&tkd->lock); - if (!tks->clock_valid) + if (!timekeeper_is_clock_valid(tks)) continue; =20 timekeeping_forward_now(tks); @@ -3127,7 +3132,7 @@ static void tk_aux_advance(void) struct tk_data *aux_tkd =3D &timekeeper_data[id + TIMEKEEPER_AUX_FIRST]; =20 guard(raw_spinlock)(&aux_tkd->lock); - if (aux_tkd->shadow_timekeeper.clock_valid) + if (timekeeper_is_clock_valid(&aux_tkd->shadow_timekeeper)) __timekeeping_advance(aux_tkd, TK_ADV_TICK); } } @@ -3155,7 +3160,7 @@ bool ktime_get_aux(clockid_t id, ktime_t *kt) aux_tk =3D &aux_tkd->timekeeper; do { seq =3D read_seqcount_begin(&aux_tkd->seq); - if (!aux_tk->clock_valid) + if (!timekeeper_is_clock_valid(aux_tk)) return false; =20 base =3D ktime_add(aux_tk->tkr_mono.base, aux_tk->offs_aux); @@ -3214,7 +3219,7 @@ static int aux_clock_set(const clockid_t id, const st= ruct timespec64 *tnew) aux_tks =3D &aux_tkd->shadow_timekeeper; =20 guard(raw_spinlock_irq)(&aux_tkd->lock); - if (!aux_tks->clock_valid) + if (!timekeeper_is_clock_valid(aux_tks)) return -ENODEV; =20 /* Forward the timekeeper base time */ --=20 2.55.0