arm64: Add support ARCH_SUPPORTS_INT128
PATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
The gcc support __SIZEOF_INT128__ and __int128 in arm64, thus, enable ARCH_SUPPORTS_INT128 to make mul_u64_u32_shr() a bit more efficient in scheduler.
--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig +1 -0
@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
Signature · 1 line
1.7.12.4
PATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
Quoted 5 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>
Queued for 4.8. Thanks.
Signature · 1 line
Catalin
Catalin Marinas
maintainerPATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
In reply to Kefeng WangQuoted 14 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm64/Kconfig +0
-0
arch/arm64/Kconfig config ARM64 · line 17
Quoted 7 lines
arch/arm64/Kconfig +1
-0@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
With this patch and UBSAN+KASAN enabled, Linux fails to link with:
lib/built-in.o: In function `get_signed_val':lib/ubsan.c:93: undefined reference to __ashlti3' lib/ubsan.c:93: undefined reference to __ashrti3'
It succeeds if I revert commit d67703a8a69e ("arm64: kill off the libgcc dependency"). We may have to revisit that decision or implement the required library functions in the kernel. In general, I'd like to reduce the amount of code duplication if the functionality can be found elsewhere like in libgcc. There is a risk of not knowing precisely what ligbcc relies on (like libc functions), though there are other architectures linking against it.
Signature · 1 line
Catalin
PATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
Quoted 29 lines · Catalin Marinas
Quoted 14 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm64/Kconfig +0
-0arch/arm64/Kconfig config ARM64 · line 17
Quoted 7 lines
arch/arm64/Kconfig +1
-0@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSIONWith this patch and UBSAN+KASAN enabled, Linux fails to link with:
lib/built-in.o: In function `get_signed_val':lib/ubsan.c:93: undefined reference to__ashlti3' lib/ubsan.c:93: undefined reference to__ashrti3'
Quoted 7 lines
It succeeds if I revert commit
d67703a8a69e("arm64: kill off the libgcc dependency"). We may have to revisit that decision or implement the required library functions in the kernel. In general, I'd like to reduce the amount of code duplication if the functionality can be found elsewhere like in libgcc. There is a risk of not knowing precisely what ligbcc relies on (like libc functions), though there are other architectures linking against it.
Linking agianst libgcc is pretty scary if we're starting to use plugins for the compiler[1], but IANAL.
Will
Catalin Marinas
maintainerPATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
Quoted 38 lines · Will Deacon
Quoted 29 lines · Catalin Marinas
Quoted 14 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm64/Kconfig +0
-0arch/arm64/Kconfig config ARM64 · line 17
Quoted 7 lines
arch/arm64/Kconfig +1
-0@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSIONWith this patch and UBSAN+KASAN enabled, Linux fails to link with:
lib/built-in.o: In function `get_signed_val':lib/ubsan.c:93: undefined reference to__ashlti3' lib/ubsan.c:93: undefined reference to__ashrti3'Quoted 7 lines
It succeeds if I revert commit
d67703a8a69e("arm64: kill off the libgcc dependency"). We may have to revisit that decision or implement the required library functions in the kernel. In general, I'd like to reduce the amount of code duplication if the functionality can be found elsewhere like in libgcc. There is a risk of not knowing precisely what ligbcc relies on (like libc functions), though there are other architectures linking against it.
Quoted 2 lines
Linking agianst libgcc is pretty scary if we're starting to use plugins for the compiler[1], but IANAL.
At a quick grep, there are 9 other architectures linking the kernel image against libgcc. I wonder what they do about it.
For the time being, I'm reverting this patch. It's probably not that hard to add the int128 variants of these functions to the kernel (in a GPLv2 variant).
Signature · 1 line
Catalin
PATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
In reply to Catalin MarinasQuoted 29 lines · Catalin Marinas
Quoted 14 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)arch/arm64/Kconfig +0
-0arch/arm64/Kconfig config ARM64 · line 17
Quoted 7 lines
arch/arm64/Kconfig +1
-0@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSIONWith this patch and UBSAN+KASAN enabled, Linux fails to link with:
lib/built-in.o: In function `get_signed_val':lib/ubsan.c:93: undefined reference to__ashlti3' lib/ubsan.c:93: undefined reference to__ashrti3'
Quoted 8 lines
It succeeds if I revert commit
d67703a8a69e("arm64: kill off the libgcc dependency"). We may have to revisit that decision or implement the required library functions in the kernel. In general, I'd like to reduce the amount of code duplication if the functionality can be found elsewhere like in libgcc. There is a risk of not knowing precisely what ligbcc relies on (like libc functions), though there are other architectures linking against it.
I wonder if this change is such a huge win if we simply end up invoking support routines in libgcc to implement the 128-bit arithmetic. Do we have any benchmark results?
PATCH 1/1 arm64: Add support ARCH_SUPPORTS_INT128
In reply to Catalin MarinasQuoted 10 lines · Catalin Marinas
Quoted 9 lines · Kefeng Wang
The gcc support
__SIZEOF_INT128__and__int128in arm64, thus, enableARCH_SUPPORTS_INT128to makemul_u64_u32_shr()a bit more efficient in scheduler.Signed-off-by Kefeng Wang <[email protected]>--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)
Quoted 14 lines
arch/arm64/Kconfig config ARM64 · line 17
Quoted 12 lines
arch/arm64/Kconfig +1
-0@@ -11,6 +11,7 @@ config ARM64 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_CMPXCHG_LOCKREF select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_SUPPORTS_INT128 select ARCH_SUPPORTS_NUMA_BALANCING select ARCH_WANT_OPTIONAL_GPIOLIB select ARCH_WANT_COMPAT_IPC_PARSE_VERSIONWith this patch and UBSAN+KASAN enabled, Linux fails to link with:
Hi Catalin,
I use an old gcc version[1], after enable CONFIG_UBSAN, I got some build error,
wkf at linux:~/work/linux/build-64> ../scripts/diffconfig .config*
UBSAN n -> y
+UBSAN_ALIGNMENT n
+UBSAN_SANITIZE_ALL y
arch/arm64/kernel/built-in.o: In function `c_show':
/home/wkf/work/linux/build-64/../arch/arm64/kernel/cpuinfo.c:125:(.text+0xfb28): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `loops_per_jiffy' defined in .data section in init/built-in.o /home/wkf/work/linux/build-64/../arch/arm64/kernel/cpuinfo.c:125:(.text+0xfccc): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol loops_per_jiffy' defined in .data section in init/built-in.o drivers/built-in.o: In function _until_dmac_idle':
/home/wkf/work/linux/build-64/../drivers/dma/pl330.c:916:(.text+0x1920e0): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol loops_per_jiffy' defined in .data section in init/built-in.o drivers/built-in.o: In function xen_alloc_coherent_pages':
/home/wkf/work/linux/build-64/../arch/arm64/include/../../arm/include/asm/xen/page-coherent.h:24:(.text+0x1f3b2c): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol dummy_dma_ops' defined in .data section in arch/arm64/mm/built-in.o drivers/built-in.o: In function flush':
/home/wkf/work/linux/build-64/../drivers/spi/spi-pl022.c:549:(.text+0x4080f8): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol loops_per_jiffy' defined in .data section in init/built-in.o drivers/built-in.o: In function e1000_clean_rx_irq_ps':
/home/wkf/work/linux/build-64/../drivers/net/ethernet/intel/e1000e/netdev.c:1394:(.text+0x49a864): relocation truncated to fit: R_AARCH64_LDST32_ABS_LO12_NC against symbol copybreak' defined in .data section in drivers/built-in.o drivers/built-in.o: In function e1000_clean_rx_irq':
/home/wkf/work/linux/build-64/../drivers/net/ethernet/intel/e1000e/netdev.c:1018:(.text+0x49c408): relocation truncated to fit: R_AARCH64_LDST32_ABS_LO12_NC against symbol copybreak' defined in .data section in drivers/built-in.o drivers/built-in.o: In function e1000_clean_jumbo_rx_irq':
/home/wkf/work/linux/build-64/../drivers/net/ethernet/intel/e1000e/netdev.c:1609:(.text+0x49d28c): relocation truncated to fit: R_AARCH64_LDST32_ABS_LO12_NC against symbol copybreak' defined in .data section in drivers/built-in.o drivers/built-in.o: In function led_trigger_unregister':
/home/wkf/work/linux/build-64/../drivers/leds/led-triggers.c:233:(.text+0x7865e0): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol leds_list' defined in .data section in drivers/built-in.o drivers/built-in.o: In function led_trigger_register':
/home/wkf/work/linux/build-64/../drivers/leds/led-triggers.c:206:(.text+0x78693c): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol leds_list' defined in .data section in drivers/built-in.o drivers/built-in.o: In function tegra124_132_clock_init_post':
/home/wkf/work/linux/build-64/../drivers/clk/tegra/clk-tegra124.c:1641:(.init.text+0x3bd34): additional relocation overflows omitted from the output
make[2]: *** [vmlinux] Error 1
make[1]: *** [sub-make] Error 2
make: *** [__sub-make] Error 2
[1] gcc version
wkf at linux:~/work/linux/build-64> aarch64-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=aarch64-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/opt/gcc-linaro-4.9-2014.11-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/4.9.3/lto-wrapper
Target: aarch64-linux-gnu
Configured with: /home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/snapshots/gcc-linaro-4.9-2014.11/configure SHELL=/bin/bash --with-bugurl=https://bugs.linaro.org --with-mpc=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-mpfr=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gmp=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu --with-gnu-as --with-gnu-ld --disable-libstdcxx-pch --disable-libmudflap --with-cloog=no --with-ppl=no --with-isl=no --disable-nls --enable-multiarch --disable-multilib --enable-c99 --with-arch=armv8-a --disable-shared --enable-static --with-build-sysroot=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/sysroots/aarch64-linux-gnu --enable-lto --! enable-l
inker-build-id --enable-long-long --enable-shared --with-sysroot=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu/libc --enable-languages=c,c++,fortran,lto -enable-fix-cortex-a53-835769 --enable-checking=release --with-bugurl=https://bugs.linaro.org --with-pkgversion='Linaro GCC 2014.11' --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=aarch64-linux-gnu --prefix=/home/buildslave/workspace/BinaryRelease/label/x86_64/target/aarch64-linux-gnu/_build/builds/destdir/x86_64-unknown-linux-gnu
Thread model: posix
gcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)
Quoted 4 lines
lib/built-in.o: In function `get_signed_val':lib/ubsan.c:93: undefined reference to__ashlti3' lib/ubsan.c:93: undefined reference to__ashrti3'
Will update the new gcc and try again.
Thanks,
Kefeng
Quoted 9 lines
It succeeds if I revert commit
d67703a8a69e("arm64: kill off the libgcc dependency"). We may have to revisit that decision or implement the required library functions in the kernel. In general, I'd like to reduce the amount of code duplication if the functionality can be found elsewhere like in libgcc. There is a risk of not knowing precisely what ligbcc relies on (like libc functions), though there are other architectures linking against it.