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=1796381390; b=oqc1IU3OHxSThSIEG/TwjLKg/t4kGaf9qUYPuOyv6pSFzkdPJCIqskGMjLVBB5JLzlUc bB01nuffywFt+xz9prTuRbCbvQcAAcI7cW0ix5zSHZ935CFhcj97l6JfFOKXj9osrxEiC DSOEiwibT+CkvDmVdZ1M88Lwk2El89hl7m09F0aMZPV0TVVZdifvTK16pgD/r7tDNMp4n ctjNis3Na8QkXkonIWOFInMNjuoPFEnY5ApKnmBLGP7bfFA110uFky/JyZTo5BmZIPoCA OXZ7SRpmWkGQkvihYfyRRLgUdMsVeJ6Sjm6eEqaMzxHdMRmg0T9bhLmilarIHUfLwRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381390; 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=d7uiJNgWfWFqA73avJE3VOSzk/91sk5bCKGbetoTC7U=; b=D+W5qzQYBZFeBnV2O5ukOKdukc6Urguk50SPXaCxhQ194299vb0eel5NV6QBbWZ2XOpC dCp/63QSvy76lw6jhuJqEa489fuAzsKMqcZVwW6INIy3XOKxn/fjwIQvPmN2d+epASf7i n92b6Q/seEMlM8JDB54dTTzl9qF/gfhpvsZMndDRGgOIWXZYRxWxHQ+2E8pQ/mYTiX70S vvU5SQ/rg17MC8K+Re3mwidJAzj+fYjRUGyY942hf49vGwxqZR9XBnJAWfQNwAYVZtSzz 5RbNi7Dop2NFZZrUgNIXGNIP79kP28XbcUUdC1NSBHtcCFxQi3RBPqaJ8c5/cgIN06w== 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=MxkH6qNb; 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 81F54606A322; Fri, 4 Dec 2026 10:49:50 +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=MxkH6qNb Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBB1D1F00897; Fri, 4 Dec 2026 10:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381390; bh=d7uiJNgWfWFqA73avJE3VOSzk/91sk5bCKGbetoTC7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MxkH6qNbiQkeyUsCIMV3/DwHMcM1IaFLjjpPYgDOwRMAz9EenEsMUhDeMztWt+OWD OKRWXPEl/MA34IDsd9j3G56ZOwFcNd8+uzusCt2zNdbpZJF7mIL5stqYAysvvOnl/M 2tKylfmLynvbSh2zMK/Iuq80Z0chdslfvtXF75Ss= 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 7.3 683/742] vdso/math64: Use OPTIMIZER_HIDE_VAR() in __iter_div_u64_rem() Date: Fri, 4 Dec 2026 19:09:07 +0900 Message-ID: <20261204100653.198372891@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-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