From nobody Tue Apr 7 23:43:43 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 666383E2762; Wed, 11 Mar 2026 14:51:53 +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=1773240715; cv=none; b=R6sHPyvB2h0CYRHQDiBoN0obb4lRweP9QBKgIyDUZsDmP2w44CKKNK4f+2beYGHbmjyqdTMaAruu3BwGnsW1O5fwRK5vHKVzN+4Ws+SmECnstXn0VDfbPuIV6LuXzcxBS+Xt74mhp5tSIIrYGW36jOH6MlynBi7OvXXFPwLx6LU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773240715; c=relaxed/simple; bh=A2eSxPrBfTQCETtCewnpq633x6ePI4GZc10bj0Eg3kE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=nTzjbiU/x9b35Of6VS/IffVCQUf5AzMARk43lyJ2nYCSQXv1aBY+1v0FcFxvalm44HfXMNTm3/up7TALZpFtVfYfnw8AQWGVMbOffscDK5XIjUOryEl47ug+m5cya96vlx9B9NEWSgHNae/atGHy8sWoUZXKel45zUuFSA8jOQ8= 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=2Kg2NkoL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=AZQ6dm61; 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="2Kg2NkoL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="AZQ6dm61" Date: Wed, 11 Mar 2026 14:51:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773240712; 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=Sbhqjf1/EtF8oL0gAzRBxtjZ4lwpyr2kIjhBl5jsejo=; b=2Kg2NkoLFmQQ3aCtiMjNBlqvRewAfRd88abI8YjQaLiRofm/SAa+fC1GQHrq15T/YuaJC3 gQJbmk+TJLhat2UrPMHp6aPuYEYUnoeXr8Nf4wHHkbuaaI99AXZZyKytfblEXkkVfWKiwr YxEe3xmMgMfVsN6ruChQT0frEexCaR1oIcUMScSwH2zSH8E9bH+ERMx0VP37IC3tbERh3B Fkbe41LYCgAHUEJSFlOIPNMZTa7xQFLMiE0Y5CDKbuQSIZgCeYLeB+pzGJOdDqCeyrykS5 J6uiPxSQdxpm+gNLZcsp4Z9LZW3i8E+UQ3VZgcK9pzuGKClWPN7wcH0FZDQHuQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773240712; 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=Sbhqjf1/EtF8oL0gAzRBxtjZ4lwpyr2kIjhBl5jsejo=; b=AZQ6dm61OCQXq+swIq57NvBcAyQnw8B0zN8Qf2mNtKE/ofuwDchAuRZeegIIHhgEp24iBo qtbXwPnVtPez9WAA== 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: Move the unlikely() into vdso_read_retry() 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-4-c848b4bc4850@linutronix.de> References: <20260227-vdso-cleanups-v1-4-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: <177324071075.1647592.15206683661720253600.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: 0c02d6df15d4bf7376a965b66d92ad31b0e458fd Gitweb: https://git.kernel.org/tip/0c02d6df15d4bf7376a965b66d92ad31b= 0e458fd Author: Thomas Wei=C3=9Fschuh AuthorDate: Fri, 27 Feb 2026 07:43:23 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 11 Mar 2026 15:12:05 +01:00 vdso/gettimeofday: Move the unlikely() into vdso_read_retry() All callers of vdso_read_retry() test its return value with unlikely(). Move the unlikely into the helper to make the code easier to read. This is equivalent to the retry function of non-vDSO seqlocks. 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-4-c848b4bc4850@lin= utronix.de --- include/vdso/helpers.h | 2 +- lib/vdso/gettimeofday.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h index 4d35877..197d233 100644 --- a/include/vdso/helpers.h +++ b/include/vdso/helpers.h @@ -53,7 +53,7 @@ static __always_inline u32 vdso_read_retry(const struct v= dso_clock *vc, =20 smp_rmb(); seq =3D READ_ONCE(vc->seq); - return seq !=3D start; + return unlikely(seq !=3D start); } =20 static __always_inline void vdso_write_seq_begin(struct vdso_clock *vc) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 2faed78..efd1b82 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -135,7 +135,7 @@ bool do_hres_timens(const struct vdso_time_data *vdns, = const struct vdso_clock * =20 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 /* Add the namespace offset */ sec +=3D offs->sec; @@ -163,7 +163,7 @@ bool do_hres(const struct vdso_time_data *vd, const str= uct vdso_clock *vc, =20 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 vdso_set_timespec(ts, sec, ns); =20 @@ -188,7 +188,7 @@ bool do_coarse_timens(const struct vdso_time_data *vdns= , const struct vdso_clock seq =3D vdso_read_begin(vc); sec =3D vdso_ts->sec; nsec =3D vdso_ts->nsec; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 /* Add the namespace offset */ sec +=3D offs->sec; @@ -212,7 +212,7 @@ bool do_coarse(const struct vdso_time_data *vd, const s= truct vdso_clock *vc, =20 ts->tv_sec =3D vdso_ts->sec; ts->tv_nsec =3D vdso_ts->nsec; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 return true; } @@ -244,7 +244,7 @@ bool do_aux(const struct vdso_time_data *vd, clockid_t = clock, struct __kernel_ti =20 if (!vdso_get_timestamp(vd, vc, VDSO_BASE_AUX, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 vdso_set_timespec(ts, sec, ns); =20