arm64: crypto: Disable xor-neon build when using clang
PATCH 1/1 arm64: crypto: Disable xor-neon build when using clang
Currently clang is able to build an arm64 defconfig or allmodconfig using the release branch for clang 8 apart from a series of errors in xor-neon.c in the form:
arch/arm64/lib/xor-neon.c:27:28: error: incompatible pointer types assigning to 'const unsigned long *' from 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]
This issue has been extensively discussed between various interested parties but it is still unclear what if any the best solution is in the compiler and there are concerns about just disabling the warning with a pragma in the header due to the potential for masking other serious issues. Details of the discussion can be followed here:
https://github.com/ClangBuiltLinux/linux/issues/283
In order to avoid the issue and facilitate further clang work and testing for the time being just disable the use of xor-neon.c if we are building with clang. Obviously this is not actually resolving the problem and is not something that should be with us for the long term but since it only affects clang and enables people working on that to work directly with upstream it seems like a useful tradeoff.
---
It would also be possible to achieve the same effect by using either a Makefile change or a pragma to disable the warning for this specific file, I can send a patch for those approaches if that's OK and preferable. Disabling the acceleration entirely seemed safer and less likely to be forgotten to me.
We've got some KernelCI support for clang in the middle of getting deployed:
https://staging.kernelci.org/job/next-clang/branch/master/
so being able to build and run upstream kernels directly would be enormously helpful.
arch/arm64/include/asm/xor.h | 2 +- arch/arm64/lib/Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm64/include/asm/xor.h +1 -1
@@ -14,7 +14,7 @@#include <asm/hwcap.h> #include <asm/neon.h> -#ifdef CONFIG_KERNEL_MODE_NEON +#if defined(CONFIG_KERNEL_MODE_NEON ) && !defined(CONFIG_CC_IS_CLANG )extern struct xor_block_template const xor_block_inner_neon;
arch/arm64/lib/Makefile +2 -0
@@ -6,10 +6,12 @@ lib-y := clear_user.o delay.o copy_from_user.o \ strchr.o strrchr.o tishift.o ifeq ($(CONFIG_KERNEL_MODE_NEON), y) +ifneq ($(CONFIG_CC_IS_CLANG), y) obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o CFLAGS_REMOVE_xor-neon.o += -mgeneral-regs-only CFLAGS_xor-neon.o += -ffreestanding endif +endif # Tell the compiler to treat all general purpose registers (with the # exception of the IP registers, which are already handled by the caller
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 74 lines · Mark Brown
Currently clang is able to build an arm64 defconfig or allmodconfig using the release branch for clang 8 apart from a series of errors in
xor-neon.cin the form:
arch/arm64/lib/xor-neon.c:27:28: error: incompatible pointer types assigning to 'const unsigned long *' from 'uint64_t*' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]This issue has been extensively discussed between various interested parties but it is still unclear what if any the best solution is in the compiler and there are concerns about just disabling the warning with a pragma in the header due to the potential for masking other serious issues. Details of the discussion can be followed here:
https://github.com/ClangBuiltLinux/linux/issues/283
In order to avoid the issue and facilitate further clang work and testing for the time being just disable the use of
xor-neon.cif we are building with clang. Obviously this is not actually resolving the problem and is not something that should be with us for the long term but since it only affects clang and enables people working on that to work directly with upstream it seems like a useful tradeoff.Signed-off-by Mark Brown <[email protected]>---
It would also be possible to achieve the same effect by using either a
Makefilechange or a pragma to disable the warning for this specific file, I can send a patch for those approaches if that's OK and preferable. Disabling the acceleration entirely seemed safer and less likely to be forgotten to me.We've got some KernelCI support for clang in the middle of getting deployed:
https://staging.kernelci.org/job/next-clang/branch/master/
so being able to build and run upstream kernels directly would be enormously helpful.
arch/arm64/include/asm/xor.h | 2 +- arch/arm64/lib/Makefile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)arch/arm64/include/asm/xor.h +1
-1@@ -14,7 +14,7 @@#include <asm/hwcap.h> #include <asm/neon.h> -#ifdef CONFIG_KERNEL_MODE_NEON +#if defined(CONFIG_KERNEL_MODE_NEON ) && !defined(CONFIG_CC_IS_CLANG )extern struct xor_block_template const xor_block_inner_neon;arch/arm64/lib/Makefile +2
-1@@ -6,10 +6,12 @@ lib-y := clear_user.o delay.o copy_from_user.o \ strchr.o strrchr.o tishift.o ifeq ($(CONFIG_KERNEL_MODE_NEON), y) +ifneq ($(CONFIG_CC_IS_CLANG), y) obj-$(CONFIG_XOR_BLOCKS) += xor-neon.o CFLAGS_REMOVE_xor-neon.o += -mgeneral-regs-only CFLAGS_xor-neon.o += -ffreestanding endif +endif # Tell the compiler to treat all general purpose registers (with the # exception of the IP registers, which are already handled by the caller --
Quoted 2 lines
2.20.1
Can we just add the pragma to neon-instrinsics.h and be done with it? As long as Clang is not the dominant compiler, I don't buy the 'hiding real bugs' argument, especially since neon-intrinsics.h should never be included transitively, so it only affects source files that actually call NEON intrinsics.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 5 lines · Ard Biesheuvel
Can we just add the pragma to
neon-instrinsics.hand be done with it? As long as Clang is not the dominant compiler, I don't buy the 'hiding real bugs' argument, especially sinceneon-intrinsics.hshould never be included transitively, so it only affects source files that actually call NEON intrinsics.
That's fine from my point of view, when posting this I was basically just going for the most conservative workaround possible.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 11 lines · Mark Brown
Quoted 5 lines · Ard Biesheuvel
Can we just add the pragma to
neon-instrinsics.hand be done with it? As long as Clang is not the dominant compiler, I don't buy the 'hiding real bugs' argument, especially sinceneon-intrinsics.hshould never be included transitively, so it only affects source files that actually call NEON intrinsics.That's fine from my point of view, when posting this I was basically just going for the most conservative workaround possible.
Idealistically, I'm not really happy with either. But pragmatically, if this is the last thing preventing us from turning on KernelCI support for arm64+clang; I'll pick the lesser of two evils, which would be the pragma (vs disabling the whole translation unit). We can always revisit why all of this complexity is going into this particular part of the code later when we have more time. I'm focused right now on finding bugs in llvm asm goto support so that it works well when it lands, and upstreaming lld support, but hopefully we can revisit this more later, when I have more time and energy.
Nathan's patch [0] is probably ready to go; with Ard's suggested by tag [1]. Again, I'm not happy about it; but KernelCI coverage is ultimately more important to the project.
[0] https://github.com/ClangBuiltLinux/linux/issues/283#issuecomment-457093369
[1] https://github.com/ClangBuiltLinux/linux/issues/283#issuecomment-457087288
Signature · 7 lines
Thanks, ~Nick Desaulniers _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 3 lines · Nick Desaulniers
Nathan's patch [0] is probably ready to go; with Ard's suggested by tag [1]. Again, I'm not happy about it; but KernelCI coverage is ultimately more important to the project.
OK, Nathan will you post that?
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 7 lines · Mark Brown
Quoted 3 lines · Nick Desaulniers
Nathan's patch [0] is probably ready to go; with Ard's suggested by tag [1]. Again, I'm not happy about it; but KernelCI coverage is ultimately more important to the project.
OK, Nathan will you post that?
Yes, I can do it later today.
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel