summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 11:48:34 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 11:48:34 -0700
commit9d2e34897d8dfe8b85603ee0a5d4f0481e991824 (patch)
treec0a330579f43e8dc77f2322b2f113f535a622758
parente6ef760731ada512d7258c5ed48423144f831eab (diff)
parent2fd8eb4ad87104c54800ef3cea498c92eb15c78a (diff)
downloadlinux-9d2e34897d8dfe8b85603ee0a5d4f0481e991824.tar.bz2
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Will Deacon: "Catalin's out enjoying the sunshine, so I'm sending the fixes for a couple of weeks (although there hopefully won't be any more!). We've got a revert of a previous fix because it broke the build with some distro toolchains and a preemption fix when detemining whether or not the SIMD unit is in use. Summary: - Revert back to the 'linux' target for LD, as 'elf' breaks some distributions - Fix preemption race when testing whether the vector unit is in use or not" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: neon: Fix function may_use_simd() return error status Revert "arm64: Use aarch64elf and aarch64elfb emulation mode variants"
-rw-r--r--arch/arm64/Makefile6
-rw-r--r--arch/arm64/include/asm/simd.h19
2 files changed, 11 insertions, 14 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 7976d2d242fa..e7101b19d590 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -60,13 +60,15 @@ ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__AARCH64EB__
AS += -EB
-LDFLAGS += -EB -maarch64elfb
+# We must use the linux target here, since distributions don't tend to package
+# the ELF linker scripts with binutils, and this results in a build failure.
+LDFLAGS += -EB -maarch64linuxb
UTS_MACHINE := aarch64_be
else
KBUILD_CPPFLAGS += -mlittle-endian
CHECKFLAGS += -D__AARCH64EL__
AS += -EL
-LDFLAGS += -EL -maarch64elf
+LDFLAGS += -EL -maarch64linux # See comment above
UTS_MACHINE := aarch64
endif
diff --git a/arch/arm64/include/asm/simd.h b/arch/arm64/include/asm/simd.h
index fa8b3fe932e6..6495cc51246f 100644
--- a/arch/arm64/include/asm/simd.h
+++ b/arch/arm64/include/asm/simd.h
@@ -29,20 +29,15 @@ DECLARE_PER_CPU(bool, kernel_neon_busy);
static __must_check inline bool may_use_simd(void)
{
/*
- * The raw_cpu_read() is racy if called with preemption enabled.
- * This is not a bug: kernel_neon_busy is only set when
- * preemption is disabled, so we cannot migrate to another CPU
- * while it is set, nor can we migrate to a CPU where it is set.
- * So, if we find it clear on some CPU then we're guaranteed to
- * find it clear on any CPU we could migrate to.
- *
- * If we are in between kernel_neon_begin()...kernel_neon_end(),
- * the flag will be set, but preemption is also disabled, so we
- * can't migrate to another CPU and spuriously see it become
- * false.
+ * kernel_neon_busy is only set while preemption is disabled,
+ * and is clear whenever preemption is enabled. Since
+ * this_cpu_read() is atomic w.r.t. preemption, kernel_neon_busy
+ * cannot change under our feet -- if it's set we cannot be
+ * migrated, and if it's clear we cannot be migrated to a CPU
+ * where it is set.
*/
return !in_irq() && !irqs_disabled() && !in_nmi() &&
- !raw_cpu_read(kernel_neon_busy);
+ !this_cpu_read(kernel_neon_busy);
}
#else /* ! CONFIG_KERNEL_MODE_NEON */