Message ID | 20190926060353.54894-3-vincenzo.frascino@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: vdso32: Address various issues | expand |
On Thu, Sep 26, 2019 at 07:03:51AM +0100, Vincenzo Frascino wrote: > diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h > index fb60a88b5ed4..3fd8fd6d8fc2 100644 > --- a/arch/arm64/include/asm/vdso/compat_barrier.h > +++ b/arch/arm64/include/asm/vdso/compat_barrier.h > @@ -20,7 +20,7 @@ > > #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") > > -#if __LINUX_ARM_ARCH__ >= 8 > +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) > #define aarch32_smp_mb() dmb(ish) > #define aarch32_smp_rmb() dmb(ishld) > #define aarch32_smp_wmb() dmb(ishst) > diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile > index 1fba0776ed40..1a3299d901b1 100644 > --- a/arch/arm64/kernel/vdso32/Makefile > +++ b/arch/arm64/kernel/vdso32/Makefile > @@ -55,6 +55,9 @@ endif > VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector > VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING > > +# Check for binutils support for dmb ishld > +dmbinstr := $(call as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) Is this check for the compat gas or the native one? Looking at scripts/Kbuild.include, as-instr uses CC but you'd need a COMPATCC here instead. I may have missed something but I don't think this fixes the issue Will's issue since he reported the problem with an old compat binutils.
On 9/26/19 9:30 AM, Catalin Marinas wrote: > On Thu, Sep 26, 2019 at 07:03:51AM +0100, Vincenzo Frascino wrote: >> diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h >> index fb60a88b5ed4..3fd8fd6d8fc2 100644 >> --- a/arch/arm64/include/asm/vdso/compat_barrier.h >> +++ b/arch/arm64/include/asm/vdso/compat_barrier.h >> @@ -20,7 +20,7 @@ >> >> #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") >> >> -#if __LINUX_ARM_ARCH__ >= 8 >> +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) >> #define aarch32_smp_mb() dmb(ish) >> #define aarch32_smp_rmb() dmb(ishld) >> #define aarch32_smp_wmb() dmb(ishst) >> diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile >> index 1fba0776ed40..1a3299d901b1 100644 >> --- a/arch/arm64/kernel/vdso32/Makefile >> +++ b/arch/arm64/kernel/vdso32/Makefile >> @@ -55,6 +55,9 @@ endif >> VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector >> VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING >> >> +# Check for binutils support for dmb ishld >> +dmbinstr := $(call as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) > > Is this check for the compat gas or the native one? Looking at > scripts/Kbuild.include, as-instr uses CC but you'd need a COMPATCC here > instead. > > I may have missed something but I don't think this fixes the issue > Will's issue since he reported the problem with an old compat binutils. > Good catch I thought that it was sufficient to put it in the correct makefile, but I missed that COMPATCC != CC. This selects the wrong binutils. Need to add something in Kbuild for that.
diff --git a/arch/arm64/include/asm/vdso/compat_barrier.h b/arch/arm64/include/asm/vdso/compat_barrier.h index fb60a88b5ed4..3fd8fd6d8fc2 100644 --- a/arch/arm64/include/asm/vdso/compat_barrier.h +++ b/arch/arm64/include/asm/vdso/compat_barrier.h @@ -20,7 +20,7 @@ #define dmb(option) __asm__ __volatile__ ("dmb " #option : : : "memory") -#if __LINUX_ARM_ARCH__ >= 8 +#if __LINUX_ARM_ARCH__ >= 8 && defined(CONFIG_AS_DMB_ISHLD) #define aarch32_smp_mb() dmb(ish) #define aarch32_smp_rmb() dmb(ishld) #define aarch32_smp_wmb() dmb(ishst) diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile index 1fba0776ed40..1a3299d901b1 100644 --- a/arch/arm64/kernel/vdso32/Makefile +++ b/arch/arm64/kernel/vdso32/Makefile @@ -55,6 +55,9 @@ endif VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING +# Check for binutils support for dmb ishld +dmbinstr := $(call as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1) + # Try to compile for ARMv8. If the compiler is too old and doesn't support it, # fall back to v7. There is no easy way to check for what architecture the code # is being compiled, so define a macro specifying that (see arch/arm/Makefile). @@ -62,7 +65,7 @@ VDSO_CAFLAGS += $(call cc32-option,-march=armv8-a -D__LINUX_ARM_ARCH__=8,\ -march=armv7-a -D__LINUX_ARM_ARCH__=7) VDSO_CFLAGS := $(VDSO_CAFLAGS) -VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1 +VDSO_CFLAGS += -DENABLE_COMPAT_VDSO=1 $(dmbinstr) # KBUILD_CFLAGS from top-level Makefile VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \
As reported by Will Deacon, older versions of binutils that do not support certain types of memory barriers can cause build failure of the vdso32 library. Add a compilation time mechanism that detects if binutils supports those instructions and configure the kernel accordingly. Cc: Will Deacon <will@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com> --- arch/arm64/include/asm/vdso/compat_barrier.h | 2 +- arch/arm64/kernel/vdso32/Makefile | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)