From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382800; b=JfUhGbJ7slhUnvSUpAc5pN8aSJ4Lmjq+QS9GtgNx40Yp5gWblA8eMnYlcQYC5u2NZJ1k Y3XJEwHJmia2ptx7Jv3VNlUNDBzQt0GWTRrajGzCI2uvbjNb/+8tww4rb2OzDCdK/ZOdA lxqnNIZswR8EGhZpMuWUr43kkWRcoCkIf8AXyIUIzkEouEaShrnXOqmSBjnwtGHfZ4NcZ V/6e9luq+ORyko0fi8X14PyhKY6OGv5wZxrL8R2FluMY7ATFvF68wzpwWM+Aa9Tl/ER3W /hA5uR4CIu2025+uLLraKJuLJoh6aeniskfPOpoeClaOeGXjcY/XTdsSqgAOt1C9m+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382800; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=uKV/OVVBWyJnC+clZlZY+Kwy9PnbsMduPVvn/P0QePU=; b=DjnX17+CVRIwlwqz2BN10ettMz+gYfE8YxTW5zEIaiykbOQZ7X4LsV8KlXa08yT5Dmqd gIxmeilxPfqg+bkt39wsLbbrhrZQKxu/VVb7t8mau/IiagQaBWNm/rRoFJdAKLlaZcZq7 /jx6djWQ5bAY4kgPYunHq0X6mMpxid2joV8Xp61d2SicM6mYNjpyp6CxvO2rvpW5MAl4W FJU7m+N3sUsKeA3NJQtHwNg6wYb1vzyD8P9nVVByZ7Z63UTp57OZfTgwtV9xORGXA4m18 IJh7d+qHMi0jU8f+ClSrTRcQ0Emfx6qri37e3pU/+uJclGHNXssQObVvjPoejyuMRcA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gFzHQGmS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 876F1606A334; Fri, 4 Dec 2026 11:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=gFzHQGmS Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1DDD1F00A0A; Fri, 4 Dec 2026 11:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382800; bh=uKV/OVVBWyJnC+clZlZY+Kwy9PnbsMduPVvn/P0QePU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=gFzHQGmSAVxlTcGqmDjSBixygidBUtpCl8VFAm0di5N9NyVtcIUgdqU8pls0ojFQi c7TWv/yIDh6XeEx6bNG9GUsNTyee1EwJ/itXbkrkAcjsmfxACzJj15nB3+1pplu3zJ 90C0opIlTERE1ycmqmRPk5XrDuUJRZcbg4j0MWmc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, kernel test robot , Zhan Xusheng , Thomas Gleixner , Sasha Levin Subject: [PATCH 6.18 605/703] vdso/math64: Use OPTIMIZER_HIDE_VAR() in __iter_div_u64_rem() Date: Fri, 4 Dec 2026 19:08:24 +0900 Message-ID: <20261204100643.871014799@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhan Xusheng [ Upstream commit c1b910b270fee8930865410455f71e273f4c602c ] __iter_div_u64_rem() open-codes an empty asm() to keep the compiler from turning the subtraction loop into a modulo operation. That is what OPTIMIZER_HIDE_VAR() is for, so use it and reflow the comment. The macro lives in linux/compiler.h, which this header did not include. vdso/math64.h is reached from linux/math64.h, whose includes are linux/types.h, linux/math.h, asm/div64.h and vdso/math64.h; none of them guarantees linux/compiler.h. x86 happens to get it through asm/div64.h -> linux/log2.h, m68k's asm/div64.h only pulls in asm-generic/div64.h and linux/types.h, so the macro is undeclared there and the build fails with -Werror=implicit-function-declaration. Include linux/compiler.h so the header no longer depends on its includer. This is a no-op for the vDSO, where lib/vdso/gettimeofday.c already gets it through linux/build_bug.h, and vdso/unaligned.h sets the same precedent by including linux/compiler_types.h. Reported-by: kernel test robot Signed-off-by: Zhan Xusheng Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20261002153104.1347978-2-zhanxusheng@xiaomi.com Closes: https://lore.kernel.org/oe-kbuild-all/202609300626.zwNjKaO6-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202609301300.uAawkHuh-lkp@intel.com/ Signed-off-by: Sasha Levin --- include/vdso/math64.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/vdso/math64.h b/include/vdso/math64.h index 2ef4905585c59..6f1e311cfdbd1 100644 --- a/include/vdso/math64.h +++ b/include/vdso/math64.h @@ -2,15 +2,18 @@ #ifndef __VDSO_MATH64_H #define __VDSO_MATH64_H -static __always_inline u32 -__iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) +#include + +static __always_inline u32 __iter_div_u64_rem(u64 dividend, u32 divisor, u64 *remainder) { u32 ret = 0; while (dividend >= divisor) { - /* The following asm() prevents the compiler from - optimising this loop into a modulo operation. */ - asm("" : "+rm"(dividend)); + /* + * Prevent the compiler from optimising this loop into a + * modulo operation. + */ + OPTIMIZER_HIDE_VAR(dividend); dividend -= divisor; ret++; -- 2.53.0