From nobody Fri Sep 25 22:19:31 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 C17EC3346A8 for ; Tue, 8 Sep 2026 06:17:40 +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=1788848263; cv=none; b=olqQm4QXuGpxRLsQ4NiRkOtCY310U4GkNZ3gWkTmOYbVfhzLdEKpbXgrIMkTvO3A96J7l58bus3m2dtNjX3s6EhXTMLMUqAA6MP7AfTJvCzD6RTyGLv5MdogFLvwdos5MUzj4SnH6yk6OeGMJqErZwiq+SCFLII36cW436OfWF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788848263; 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=ktIo/pF1Bv4JKrPYjsqGkwKZImSZriAJPlfcR63AuAodP4BPR8QHt2RkNfYpa42Hhi2r2eouJpnTnfshq2Un9Kzn9jGVYhc5wNyET9SrR9nMbMRfu7bGTLvxPxXhk6e6H5Bv8SUlf7o9p8MiAvcsVEAbg7Yb+xOiIWgny8OU9nE= 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=RQIFS2Md; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=7JKDRwPh; 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="RQIFS2Md"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="7JKDRwPh" 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=1788848259; 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=RQIFS2MdbkrHVw14+0OHwKI5ja50xivud9i2k0BSE4KJBfJsNeOgWvzHCgotNAipLnrH52 BfKLOEd9/m76X+93cSH4dwzdOEDAV1daUN/fzjZtENJv+ZMW1B0MCheC2wwFj3aND86cA7 kWyP/7+5ARHyMg5uArluZZttS+Pvn0FzAjMh++NjQo4AP196vTVuWGSqGZ67AmmJevS9z3 6g/WJTd5sk/1FNZK5YRBju1NF9ARqEKrQ7sWoZjE0gM5IRpOg5OL1ZDyoRqJMuM78Nzsdd l16XSUYNAQy58M9ULekLZGXjlArECWgEfpRiv2ZKj5+AFU2PYhbtv10Hc3gZKA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788848259; 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=7JKDRwPhDhlPQx/ZOx+RMf98H6fhO9FJloU1bC1yX0OJFe0aiQsEIJscgSn0wPIdwMOUbg D2mq+35SRQzRzJAQ== Date: Tue, 08 Sep 2026 08:17:31 +0200 Subject: [PATCH v2 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: <20260908-timekeeping-conditionals-v2-1-5ebc3e7e1da0@linutronix.de> References: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@linutronix.de> In-Reply-To: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@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=1788848252; l=1284; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=Cm91XuXYWfNnvS/8fx/3tsiF7VRLMNJTj+Jt+78NjxM=; b=F9blxA1C250gvcz+wYh+AYtWPVIcmQDvcaF1NB9AVn/Jlb2EO0D5rFfIAQgTRvgVIrdMoyBlY 6DkTNs86DI8C+IDgWHzFikwNtzemLpgomdCIiVPB80NgnwUl1ZWLf2D 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 Fri Sep 25 22:19:31 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 765CC36A341 for ; Tue, 8 Sep 2026 06:17:41 +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=1788848262; cv=none; b=B/DkcSlxqK9iyYf4/fPg0nt5U10GxN1n7yBM6D4+AAPMa0axsZhwB0oIngXJlMIqlYVwJSNgzmuy+3c4J3NsHs8URPdTqW3NrBcTH81NsW1xGPC2EyFacEF2xCkRnfNfhH1q7wSK7L6dBkb1x5RvAcTDQJCH8HlAefFQZurNw9M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788848262; c=relaxed/simple; bh=SHa7MhiH4KffXnv8vcKF3Xh1XMKP8VpWfvBOySk+YGM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TNamAjRa7JHL6bl3xJ7eiZ1CSI1Jr2lSjonsWM8aXH0W/zXhj25YHHOdL93I97RNg+wGnNdyU1ECkodsB5j2WcpmxJhb1DZ5U5+oox6TAXSYzZ8xbmeOLSKOaR9SJSDWrmVPg6Ur4wLhDy6Nj352c4/BQ+3ydvp+8sBIrhNBmN4= 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=jcsuRr61; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jDuConuS; 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="jcsuRr61"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jDuConuS" 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=1788848259; 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=jcsuRr61YPGySVkCACwzoruusomM1JoIDitDtb6GBGvqztwJltD7NuZjm6vvFB9Op1ezea T6SUFm1x5E+tBHgQAlTdJyf5PlztyI5NFckWglS4iwsIX5zwwlfz/TREA5zYT2gt6CCIce IpSMWsqKgXKtKtyrUDar6g+Z6onG9BU8J3Nzu9Yq0OC58M3kfQ7BJmWEt8vmLA3vuAJm8r vEfZdnpEj2sHr2lfkFLAw46qVAX0wx+79o25IQGT2DNiXhxZAf/WCfZYdqyE7HElMCOYGs W5jecv+5pNDGrZvFnjWFKk2/98KrJGxBWG0VxYl5kCEMJSiLTAqh1zr7Ymh4Cw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788848259; 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=jDuConuSIlhk6XzH/A6CREdqJlx0rjRQiC6FO9QFom3ybb5uGx4gGRJqhUc3e9+7sCxZ0C eiImUgtDq13FZ8AQ== Date: Tue, 08 Sep 2026 08:17:32 +0200 Subject: [PATCH v2 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: <20260908-timekeeping-conditionals-v2-2-5ebc3e7e1da0@linutronix.de> References: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@linutronix.de> In-Reply-To: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@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=1788848252; l=929; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=SHa7MhiH4KffXnv8vcKF3Xh1XMKP8VpWfvBOySk+YGM=; b=jgO0D6Hv3YUM74ZyPp/TuiU4cgIOHkuFjzH6lLJ06K6Y7+odZ085fEZMXIjhjGqlPdKeh0WfK 1+fw9jt6XvuCudV62+g6LzuZzxNaLnIKh44df9382nLV/zRmSjFfd6C 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 Fri Sep 25 22:19:31 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 DC9B3379ED7 for ; Tue, 8 Sep 2026 06:17:41 +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=1788848263; cv=none; b=PgGb30ny9RDvqXa1hNqTToL4dmgBAs1/YA2ounaKeZ8AVb2+czDof5tb62TFyb797x5Dyw9vd8191zZcOVMWrCn2mUDG66RgMeBsPhHsUWz9P8Fpy72PnZa1CkxZ+fnM6H3h4cA1ZeLOhf8XcMrqT9jjmROzUw0xRkZQX4fUzXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788848263; 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=YaE5Cp0nPEOqyWzFsWlqzC/L5y1jImXkzzAAeg4a2r2o+tVvVy1naR1I7Xg5xq4YXfkZJfF8Gm4njLegcPS1HRg438kbM45uaEW4Nvv2tfkUNz9+sVT5B6oIGJ8ImpE0RJuNH/ovraZfS/tWnBjkgs75IZtPueddFK/F58WXMi4= 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=hITQUyCd; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vMlTvLCd; 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="hITQUyCd"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vMlTvLCd" 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=1788848260; 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=hITQUyCdgzX96vlGyqIK4h/Xeq+Rz/1GabbcPaNxtcfvsz0iTm1wLWfiQwbhXDd+6w5vbt zv9ZOD2q7VCmItc1HI51gaikF2x5OdUJAfxlnQMnEH9kenVX11IstFA97hei663FZ0bG9S Dv+gDSrSgc8kLbWx6g3ZYwHakM4GRAMTsxoWwoKc4iTcf77ZYsGzld3O1ndRLQRYNBB6FW 8BWq16YeqAmo75/ukjsDQ4sW+DY8RXmMM1Xnw035kNEirvhAkLnJqTPcMbGANPeUP2X4C/ HuvsLM+6iDYL2AnfINMiHIGWFNLVEjiNezVvBoeh1HuGlnpKowMg1xiw+evcJw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788848260; 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=vMlTvLCd8+v1ebuYiyfScGUObuwjZ8srHjTDe3qIoueOkUEoJpZXmXSZYcK7v+OgUU6vuR YlLC72LRzj9LnuBw== Date: Tue, 08 Sep 2026 08:17:33 +0200 Subject: [PATCH v2 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: <20260908-timekeeping-conditionals-v2-3-5ebc3e7e1da0@linutronix.de> References: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@linutronix.de> In-Reply-To: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@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=1788848252; l=1552; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=0mF3ZSgls4zxtkywuY/G/YHlHZNhj+aK/fZo0n1LSKY=; b=m+9uUC6fqEbmiuN0wf4H6hXTNgmgkG1Ly1n7wAMJmgGRhg9z5xiRmKUzVO2dD5CDS2MClJ/Lk SM+cqCF5lcSDmCKE2/HMNb5M0SA9HX+rX9omHBlp8yzwWYTQ3sbMtsl 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 Fri Sep 25 22:19:31 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 744A637F01A for ; Tue, 8 Sep 2026 06:17:42 +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=1788848263; cv=none; b=DramB+Nc+/7IFRXzOcWZWDpW/s0YIfS5+KFiDSgfbMTTlrHXTriibVIK2aWGgUd/MLmdh4RCtRN9rlBkOSMpStkG1FnooXYLk2jjSyhn8ETEL4QwlZeGZXpt0H+3Q6HANZmtol8vmgR6UhtmmZaKBwaJLXc6DW47QmrpyvzYh+s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788848263; 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=VZK2S40DWHDv6J0ChGv2QGtyTXgEjNAXTjtKDjtVtjyh4QjKx/iE06MS3laBYy35oXy/oYXXlMDBeyqE92fRB5L+tsYEztMLkXEkzKZhTxshvydtGEpjfPEzT/OL0SQVMFTTVQowLzIeXbOvf/CjFD7Y3O4zxVNLa4BUNAenv3c= 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=LqOD+332; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rKwtusWX; 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="LqOD+332"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rKwtusWX" 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=1788848260; 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=LqOD+332larawqDNbeIqoVedQ6Dt7DbP5eib8fWeRX/ak67eVXst7PvX2SAfB/xlttiBhv w1qbdiNLtkoZRDbzaRBcuZ5EKAcAW2V69xysfJxEbLzSsBvtOXqwniHe+VFIzxKSHSA+0g CjcjGGMciN12Uis4Tl4uM2ndvZmjFCbN9KcPfRMR2E0gZAg1/PFvHn5I1ZTnmp8Wbxyx4/ SK2Znu0fP6WIV1s83vclvqh0p9C+Ec/py3lfLG50SdYt7sudK6mAlgGGpUqQ6Z8eU+q74T QFmwAmTB/eoJx16OXz3Q5/js6yZFZzUZTJJDTYhooei4flGTauN23GWt73pRhQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1788848260; 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=rKwtusWXbOZ66dxTQCQO++towjv0dzHrDMffsqhR3Si9M0aVeo4zmgG/uJ+49jCNsUhUwQ crX8fMOkUlaJ6MBQ== Date: Tue, 08 Sep 2026 08:17:34 +0200 Subject: [PATCH v2 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: <20260908-timekeeping-conditionals-v2-4-5ebc3e7e1da0@linutronix.de> References: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@linutronix.de> In-Reply-To: <20260908-timekeeping-conditionals-v2-0-5ebc3e7e1da0@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=1788848252; l=2859; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=dzGDbhhGi+3uNCM/afFVfLO4nDm3ep+Nmd9v2t11Drs=; b=eEy5iAXi4yBgReCO9UYLgmJfKNGHIFscGgfiUiMgWRKJulD4qjhuPz/3DtXmZQzkIFF85ILiZ tmjYqXvCstuDoQJW8DUeynISl/rFXcgdhlBQPFGD/Zr3gmCTS8HhnCC 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