From nobody Sun Feb 8 22:35:19 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 2552B242D66 for ; Fri, 23 Jan 2026 07:35:43 +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=1769153745; cv=none; b=byYJksMJClknLOjAMljHXnvKvrXMIwSdp8+h1LdA2xJB/HU6lAYIRUT06npNG8p0Jk0JvuhAxObOMifE8AhoRDf/ON2wls9XYg7A4btL/fYzOc+uluATsb0tQwBF7ZabUK9utSGVWKgiXe0YEKTXGL4wsY4a6l1Zpj67Ph/XTgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769153745; c=relaxed/simple; bh=D1GirPPfJfnqTqDDs2twNv3Nye7rLMrofA9XpoFVY9k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=VO2xGyOky5B5Zvwu/HKq7BWBQ+rSzw4R7U0fJ8zH+fAjURaXLciAu9rBVr0p0PFSwTQMPv6IxxpAyEgowDayukciKh9mirq8GdtiYRAuN5vzLuqv44QtM6bfrGVP8IGKx3xy5Ljb7AdgRmucCcfIDVbv67jxbbCvHiNbwE0u2Aw= 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=sf4I/PvM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Oi8e/Wj/; 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="sf4I/PvM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Oi8e/Wj/" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1769153742; 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; bh=zII8lgx72eGcr0LZxUXI/ESiSqjhAu3vBl0Q6fDkv/U=; b=sf4I/PvM0DKmXiWUHkniaPNUaE8+Dj6121TSTYSKZA85GuA8Qu5GeVJhndvASyIrDSAAHf rK5MCRzhFP0ktdyPlDMgQP0EWRKqu6j8CiOelFvEswPgEDGEhvAOCsszVy3eXnncOJGMhH p7UmAfocIGlw/U0QSX9RBfG2jhmvNMPUF8Jg1OTRrSfrN7VmEuQuR+LS/TRu/qpud+1rWV /pKgNEzR1YhrHP6xqZZzEhRVoVoUypPqMDdwD4yKYFtepM9cVYmeIhidypEx5EbJDdeBr8 v+B/qRl3EFGWRxp6NTqtrrDmS1eVs02hNM8hu7Amxn3U2zxxU4qXvm0jc9/WgA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1769153742; 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; bh=zII8lgx72eGcr0LZxUXI/ESiSqjhAu3vBl0Q6fDkv/U=; b=Oi8e/Wj/LLAXM5MURg90AfOkSM8n1ayCUrFvo8CUdY0BFUCQ21cT5lTzVcKRkSooH1pbxh tfbQWu2Tfz6WnDCg== Date: Fri, 23 Jan 2026 08:35:41 +0100 Subject: [PATCH] lib/vdso: Force inlining of __cvdso_clock_getres_common() 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: <20260123-vdso-clock_getres-inline-v1-1-4d6203b90cd3@linutronix.de> X-B4-Tracking: v=1; b=H4sIAMwkc2kC/x3MQQqDMBBG4avIrDsQB5qFVxEpJfnVwZCUTJFC8 O6GLr/Fe40MVWE0DY0qTjUtuWN8DBT2d97AGrtJnHg3ivAZrXBIJRyvDd8KY81JMxgIXlz0Tp6 gnn8qVv391/NyXTe9nykDagAAAA== X-Change-ID: 20260122-vdso-clock_getres-inline-eec620d6025e To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino , Will Deacon , "Christophe Leroy (CS GROUP)" Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1769153742; l=2799; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=D1GirPPfJfnqTqDDs2twNv3Nye7rLMrofA9XpoFVY9k=; b=FDMawr46f5TEY08FbwgDnKESAszoZ2aHWGz8TXnXFO9QxZhHtIb0kTxedbHkVaOTKIoZ5Hwid 856tKcCGvZ2Ag1u/ijm3Y4mUgk/LVaw39dHn3ttLfLnIcXsYoP1aKts X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= With CONFIG_CC_OPTIMIZE_FOR_SIZE=3Dy, gcc may decide not to inline __cvdso_clock_getres_common(). This introduces spurious internl function calls in the vDSO fastpath. Furthermore, with automatic stack variable initialization (CONFIG_INIT_STACK_ALL_ZERO or CONFIG_INIT_STACK_ALL_PATTERN) gcc can emit a call to memset() which is not valid in the vDSO. Mark the __cvdso_clock_getres_common() as __always_inline to avoid both issues. Paradoxically the inlining even reduces the size of the code: $ ./scripts/bloat-o-meter arch/powerpc/kernel/vdso/vgettimeofday-32.o.befor= e arch/powerpc/kernel/vdso/vgettimeofday-32.o.after add/remove: 0/1 grow/shrink: 1/1 up/down: 52/-148 (-96) Function old new delta __c_kernel_clock_getres_time64 92 144 +52 __c_kernel_clock_getres 136 132 -4 __cvdso_clock_getres_common 144 - -144 Total: Before=3D2788, After=3D2692, chg -3.44% With CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=3Dy the functions are always inlined and therefore the behaviour stays the same. See also the equivalent change for clock_gettime() in commit b91c8c42ffdd ("lib/vdso: Force inlining of __cvdso_clock_gettime_common()"). Reported-by: Sverdlin, Alexander Closes: https://lore.kernel.org/lkml/f45316f65a46da638b3c6aa69effd8980e6677= b9.camel@siemens.com/ Suggested-by: Christophe Leroy (CS GROUP) Link: https://lore.kernel.org/lkml/230c749f-ebd6-4829-93ee-601d88000a45@ker= nel.org/ Fixes: 21bbfd74044f ("x86/vdso: Provide clock_getres_time64() for x86-32") Fixes: 1149dcdfc9ef ("ARM: VDSO: Provide clock_getres_time64()") Fixes: f10c2e72b5de ("arm64: vdso32: Provide clock_getres_time64()") Fixes: bec06cd6a140 ("MIPS: vdso: Provide getres_time64() for 32-bit ABIs") Fixes: 759a1f97373f ("powerpc/vdso: Provide clock_getres_time64()") Signed-off-by: Thomas Wei=C3=9Fschuh --- lib/vdso/gettimeofday.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 95df0153f05a..4399e143d43a 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -421,7 +421,7 @@ static __maybe_unused __kernel_old_time_t __cvdso_time(= __kernel_old_time_t *time #endif /* VDSO_HAS_TIME */ =20 #ifdef VDSO_HAS_CLOCK_GETRES -static __maybe_unused +static __always_inline bool __cvdso_clock_getres_common(const struct vdso_time_data *vd, clockid_= t clock, struct __kernel_timespec *res) { --- base-commit: bbef8e2c29c32f048fac8e07f884f827d028f1da change-id: 20260122-vdso-clock_getres-inline-eec620d6025e Best regards, --=20 Thomas Wei=C3=9Fschuh