linux-stable/arch/arm
Nick Desaulniers 7854d3b926 ARM: 9256/1: NWFPE: avoid compiler-generated __aeabi_uldivmod
commit 3220022038 upstream.

clang-15's ability to elide loops completely became more aggressive when
it can deduce how a variable is being updated in a loop. Counting down
one variable by an increment of another can be replaced by a modulo
operation.

For 64b variables on 32b ARM EABI targets, this can result in the
compiler generating calls to __aeabi_uldivmod, which it does for a do
while loop in float64_rem().

For the kernel, we'd generally prefer that developers not open code 64b
division via binary / operators and instead use the more explicit
helpers from div64.h. On arm-linux-gnuabi targets, failure to do so can
result in linkage failures due to undefined references to
__aeabi_uldivmod().

While developers can avoid open coding divisions on 64b variables, the
compiler doesn't know that the Linux kernel has a partial implementation
of a compiler runtime (--rtlib) to enforce this convention.

It's also undecidable for the compiler whether the code in question
would be faster to execute the loop vs elide it and do the 64b division.

While I actively avoid using the internal -mllvm command line flags, I
think we get better code than using barrier() here, which will force
reloads+spills in the loop for all toolchains.

Link: https://github.com/ClangBuiltLinux/linux/issues/1666

Reported-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-07 12:07:36 +01:00
..
boot ARM: dts: armada-39x: Fix assigned-addresses for every PCIe Root Port 2023-01-07 12:07:12 +01:00
common
configs
crypto
firmware
include ARM: 9251/1: perf: Fix stacktraces for tracepoint events in THUMB2 kernels 2022-12-14 11:24:32 +01:00
kernel ARM: 9197/1: spectre-bhb: fix loop8 sequence for Thumb2 2022-05-25 08:39:50 +02:00
kvm KVM: arm64: Allow SMCCC_ARCH_WORKAROUND_3 to be discovered and migrated 2022-04-12 07:52:17 +02:00
lib ARM: crypto: comment out gcc warning that breaks clang builds 2022-08-25 11:09:21 +02:00
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed
mach-at91
mach-axxia ARM: Fix refcount leak in axxia_boot_secondary 2022-07-02 16:17:15 +02:00
mach-bcm
mach-berlin
mach-clps711x
mach-cns3xxx ARM: cns3xxx: Fix refcount leak in cns3xxx_init 2022-07-02 16:17:16 +02:00
mach-davinci ARM: davinci: da850-evm: Avoid NULL pointer dereference 2022-04-20 09:06:46 +02:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos ARM: exynos: Fix refcount leak in exynos_map_pmu 2022-07-02 16:17:15 +02:00
mach-footbridge
mach-gemini
mach-highbank
mach-hisi ARM: hisi: Add missing of_node_put after of_find_compatible_node 2022-06-14 16:52:30 +02:00
mach-imx
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek
mach-meson
mach-mmp ARM: mmp: fix timer_read delay 2023-01-07 12:07:13 +01:00
mach-moxart
mach-mv78xx0
mach-mvebu
mach-mxs ARM: mxs: fix memory leak in mxs_machine_init() 2022-12-08 11:15:39 +01:00
mach-netx
mach-nomadik
mach-nspire
mach-omap1 ARM: OMAP1: clock: Fix UART rate reporting algorithm 2022-06-14 16:52:30 +02:00
mach-omap2 ARM: OMAP2+: Fix refcount leak in omap_gic_of_init 2022-05-12 12:14:55 +02:00
mach-orion5x
mach-oxnas
mach-picoxcell
mach-prima2
mach-pxa
mach-qcom
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx ARM: 9187/1: JIVE: fix return value of __setup handler 2022-04-20 09:06:41 +02:00
mach-s3c64xx
mach-s5pv210
mach-sa1100
mach-shmobile
mach-socfpga ARM: socfpga: Fix crash with CONFIG_FORTIRY_SOURCE 2021-12-08 08:45:03 +01:00
mach-spear
mach-sti
mach-stm32
mach-sunxi
mach-tango
mach-tegra
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress ARM: versatile: Add missing of_node_put in dcscb_init 2022-06-14 16:52:30 +02:00
mach-vt8500
mach-w90x900
mach-zx
mach-zynq
mm ARM: 9209/1: Spectre-BHB: avoid pr_info() every time a CPU comes out of idle 2022-07-21 20:40:30 +02:00
net
nwfpe ARM: 9256/1: NWFPE: avoid compiler-generated __aeabi_uldivmod 2023-01-07 12:07:36 +01:00
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung
plat-versatile
probes ARM: 9139/1: kprobes: fix arch_init_kprobes() prototype 2021-11-02 17:39:22 +01:00
tools
vdso
vfp
xen xen/arm: Fix race in RB-tree based P2M accounting 2022-07-07 17:30:11 +02:00
Kconfig ARM: Drop CMDLINE_* dependency on ATAGS 2022-10-26 13:15:41 +02:00
Kconfig-nommu
Kconfig.debug ARM: fix function graph tracer and unwinder dependencies 2022-10-26 13:15:33 +02:00
Makefile ARM: 9156/1: drop cc-option fallbacks for architecture selection 2021-11-26 11:48:39 +01:00