From nobody Tue Apr 7 22:04:10 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 AE6583D34BA; Wed, 11 Mar 2026 14:51:54 +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=1773240717; cv=none; b=PxidAl8dPB6pJdTPBUnfEBtJjLzHa0471IihYumJ5QXGCxlpTYLYzhlj6kv9Hf2h0vk+M/VkVpeTcoJjr0afqNO0YIUmG6rId5mIkhEYLXUzdb7k1yQoISRQn2x/1iqZ24OxK5Ovk+2hoItEL6Gmcy9y4zZ3V+jLAeETVAZsOxw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773240717; c=relaxed/simple; bh=Ul971c5H3GpUlKNy6QIbrXHV5nQDO/+t6h8jpxYnZ2Y=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=S8K6T39F2YRpJKIJo+it2PG0rZfqxg2cQAZtiZK1W8yJPYJBxD7qrQ1baRysoVuVSiuhufoR+vMwAbPrRXNDZMuFiR1bVUuBYnJtEldZVtI1Atp3NxuSGkrKMyGjAKIZq2d1vwWLyTBWFDBn0QX6VKvgnS5fZrYs1n/Mz/8c3do= 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=eoZurxPb; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=pKQwbbet; 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="eoZurxPb"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pKQwbbet" Date: Wed, 11 Mar 2026 14:51:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773240713; h=from:from:sender:sender:reply-to: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=q5z2TF0h0FbQtqEgGBCTMA9kDiRj/e27VzN/SHqvKxU=; b=eoZurxPbr4FMm0mbAO9mQ3U9uPdGtKgkkt1LuCba/jUMufxlzWShtOa1bjwtPuGpFTuQ4e MlsdlKuIQRUp7mUX7/EelK1CllZLRjMZvKGzkCYaI/710j4nSiAuVdQQfnVPaHLybzOeE5 WY4jpzc3xQ2jyJmotI23cLXje1x7QMxZg6ejXcWC/Eoyoka1rwhehHgyF9dzHviLt0Amqo g7a26Cbh/1hr6h1SeGCR3Bn/e61ng+m4qxlhwd7/HplWYPCQyuDAiInzRh9hou6hfD2gIG LgYF8fmhOnhSMlsxohCIbCd/ZktRfJTuFLckcCAwDIExCnKRHc/h56HGtP2TUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773240713; h=from:from:sender:sender:reply-to: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=q5z2TF0h0FbQtqEgGBCTMA9kDiRj/e27VzN/SHqvKxU=; b=pKQwbbetbS0SSazeuNBNV49bghVS5sBvi06LUoqfK4nGeMAo4xZ2Ko4xW0C/Ux31cNr1bu i+gvWZjKpHgJAWBQ== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/vdso] vdso/gettimeofday: Add a helper to test if a clock is namespaced Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260227-vdso-cleanups-v1-3-c848b4bc4850@linutronix.de> References: <20260227-vdso-cleanups-v1-3-c848b4bc4850@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177324071179.1647592.13869885774751452551.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/vdso branch of tip: Commit-ID: a657bebd7f02d0ec1ddb08c1d8c572fe1e187f9c Gitweb: https://git.kernel.org/tip/a657bebd7f02d0ec1ddb08c1d8c572fe1= e187f9c Author: Thomas Wei=C3=9Fschuh AuthorDate: Fri, 27 Feb 2026 07:43:22 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 11 Mar 2026 15:09:59 +01:00 vdso/gettimeofday: Add a helper to test if a clock is namespaced Currently this logic is duplicate multiple times. Add a helper for it to make the code more readable. [ bp: Add a missing clocksource.h include, see https://lore.kernel.org/r/20260311113435-f72f81d8-33a6-4a0f-bd80-4997aa= d068cc@linutronix.de ] Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-3-c848b4bc4850@lin= utronix.de --- include/vdso/helpers.h | 8 +++++++- lib/vdso/gettimeofday.c | 9 +++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h index 9ccf6b5..4d35877 100644 --- a/include/vdso/helpers.h +++ b/include/vdso/helpers.h @@ -6,6 +6,12 @@ =20 #include #include +#include + +static __always_inline bool vdso_is_timens_clock(const struct vdso_clock *= vc) +{ + return IS_ENABLED(CONFIG_TIME_NS) && vc->clock_mode =3D=3D VDSO_CLOCKMODE= _TIMENS; +} =20 static __always_inline u32 vdso_read_begin(const struct vdso_clock *vc) { @@ -31,7 +37,7 @@ static __always_inline u32 vdso_read_begin(const struct v= dso_clock *vc) static __always_inline bool vdso_read_begin_timens(const struct vdso_clock= *vc, u32 *seq) { while (unlikely((*seq =3D READ_ONCE(vc->seq)) & 1)) { - if (IS_ENABLED(CONFIG_TIME_NS) && vc->clock_mode =3D=3D VDSO_CLOCKMODE_T= IMENS) + if (vdso_is_timens_clock(vc)) return true; cpu_relax(); } diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index e493696..2faed78 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -343,8 +343,7 @@ __cvdso_gettimeofday_data(const struct vdso_time_data *= vd, } =20 if (unlikely(tz !=3D NULL)) { - if (IS_ENABLED(CONFIG_TIME_NS) && - vc->clock_mode =3D=3D VDSO_CLOCKMODE_TIMENS) + if (vdso_is_timens_clock(vc)) vd =3D __arch_get_vdso_u_timens_data(vd); =20 tz->tz_minuteswest =3D vd[CS_HRES_COARSE].tz_minuteswest; @@ -367,8 +366,7 @@ __cvdso_time_data(const struct vdso_time_data *vd, __ke= rnel_old_time_t *time) const struct vdso_clock *vc =3D vd->clock_data; __kernel_old_time_t t; =20 - if (IS_ENABLED(CONFIG_TIME_NS) && - vc->clock_mode =3D=3D VDSO_CLOCKMODE_TIMENS) { + if (vdso_is_timens_clock(vc)) { vd =3D __arch_get_vdso_u_timens_data(vd); vc =3D vd->clock_data; } @@ -399,8 +397,7 @@ bool __cvdso_clock_getres_common(const struct vdso_time= _data *vd, clockid_t cloc if (!vdso_clockid_valid(clock)) return false; =20 - if (IS_ENABLED(CONFIG_TIME_NS) && - vc->clock_mode =3D=3D VDSO_CLOCKMODE_TIMENS) + if (vdso_is_timens_clock(vc)) vd =3D __arch_get_vdso_u_timens_data(vd); =20 /*