linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/6] arm64: vdso32: Address various issues
@ 2019-10-02 14:41 Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors Vincenzo Frascino
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

This patch series is meant to address the various compilation issues
reported recently for arm64 vdso32 [1].

v4 of the series contains a cleanup of lib/vdso Kconfig as well since
CROSS_COMPILE_COMPAT_VDSO is not required anymore by any architecture.

Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

[1] https://www.spinics.net/lists/kernel/msg3260702.html

---

v4:
  - Drop __arm64__ workaround
  - Remove COMPAT_CC_IS_GCC check
  - Remove unused configuration parameter from lib/vdso
  - Address Review Comments

v3:
  - Exposed COMPATCC
  - Addressed Review Comments

v2:
  - Fixed binutils detection
  - Addressed review comments

Vincenzo Frascino (6):
  arm64: vdso32: Fix syncconfig errors.
  arm64: vdso32: Detect binutils support for dmb ishld
  arm64: Remove gettimeofday.S
  arm64: vdso32: Remove jump label config option in Makefile
  arm64: Remove vdso_datapage.h
  lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO

 arch/arm64/Makefile                          | 18 +++--------
 arch/arm64/include/asm/vdso/compat_barrier.h |  2 +-
 arch/arm64/include/asm/vdso_datapage.h       | 33 --------------------
 arch/arm64/kernel/vdso/gettimeofday.S        |  0
 arch/arm64/kernel/vdso32/Makefile            | 14 ++++++---
 lib/vdso/Kconfig                             |  9 ------
 6 files changed, 15 insertions(+), 61 deletions(-)
 delete mode 100644 arch/arm64/include/asm/vdso_datapage.h
 delete mode 100644 arch/arm64/kernel/vdso/gettimeofday.S

-- 
2.23.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  2019-10-03 16:00   ` Catalin Marinas
  2019-10-02 14:41 ` [PATCH v4 2/6] arm64: vdso32: Detect binutils support for dmb ishld Vincenzo Frascino
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

The .config file and the generated include/config/auto.conf can
end up out of sync after a set of commands since
CONFIG_CROSS_COMPILE_COMPAT_VDSO is not updated correctly.

The sequence can be reproduced as follows:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
[...]
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
[set CONFIG_CROSS_COMPILE_COMPAT_VDSO="arm-linux-gnueabihf-"]
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

Which results in:

arch/arm64/Makefile:62: CROSS_COMPILE_COMPAT not defined or empty,
the compat vDSO will not be built

even though the compat vDSO has been built:

$ file arch/arm64/kernel/vdso32/vdso.so
arch/arm64/kernel/vdso32/vdso.so: ELF 32-bit LSB pie executable, ARM,
EABI5 version 1 (SYSV), dynamically linked,
BuildID[sha1]=c67f6c786f2d2d6f86c71f708595594aa25247f6, stripped

A similar case that involves changing the configuration parameter multiple
times can be reconducted to the same family of problems.

The reason behind it comes from the fact that the master Makefile includes
that architecture Makefile twice, once before the syncconfig and one after.
Since the synchronization of the files happens only upon syncconfig, the
architecture Makefile included before this event does not see the change in
configuration.

As a consequence of this it is not possible to handle the cross compiler
definitions inside the architecture Makefile.

Address the problem refactoring the arm64 main Makefile and removing the
misleading warnings.

As a consequence of this it is not possible anymore to set the compat
cross compiler from menuconfig but it requires to be exported via
command line.

E.g.:

$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
CROSS_COMPILE_COMPAT=arm-linux-gnueabihf-

Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/Makefile               | 18 +++++-------------
 arch/arm64/kernel/vdso32/Makefile |  2 --
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 84a3d502c5a5..dfa6a5cb99e4 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
   endif
 endif
 
+COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
+export COMPATCC
+
 ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
-  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
-
-  ifeq ($(CONFIG_CC_IS_CLANG), y)
-    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
-  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
-    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
-  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
-    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
-  else
-    export CROSS_COMPILE_COMPAT
-    export CONFIG_COMPAT_VDSO := y
-    compat_vdso := -DCONFIG_COMPAT_VDSO=1
-  endif
+  export CONFIG_COMPAT_VDSO := y
+  compat_vdso := -DCONFIG_COMPAT_VDSO=1
 endif
 
 KBUILD_CFLAGS	+= -mgeneral-regs-only $(lseinstr) $(brokengasinst)	\
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 1fba0776ed40..19e0d3115ffe 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -8,8 +8,6 @@
 ARCH_REL_TYPE_ABS := R_ARM_JUMP_SLOT|R_ARM_GLOB_DAT|R_ARM_ABS32
 include $(srctree)/lib/vdso/Makefile
 
-COMPATCC := $(CROSS_COMPILE_COMPAT)gcc
-
 # Same as cc-*option, but using COMPATCC instead of CC
 cc32-option = $(call try-run,\
         $(COMPATCC) $(1) -c -x c /dev/null -o "$$TMP",$(1),$(2))
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 2/6] arm64: vdso32: Detect binutils support for dmb ishld
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 3/6] arm64: Remove gettimeofday.S Vincenzo Frascino
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

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>
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/include/asm/vdso/compat_barrier.h | 2 +-
 arch/arm64/kernel/vdso32/Makefile            | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

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 19e0d3115ffe..77aa61340374 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -15,6 +15,8 @@ cc32-disable-warning = $(call try-run,\
 	$(COMPATCC) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP",-Wno-$(strip $(1)))
 cc32-ldoption = $(call try-run,\
         $(COMPATCC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
+cc32-as-instr = $(call try-run,\
+	printf "%b\n" "$(1)" | $(COMPATCC) $(VDSO_AFLAGS) -c -x assembler -o "$$TMP" -,$(2),$(3))
 
 # We cannot use the global flags to compile the vDSO files, the main reason
 # being that the 32-bit compiler may be older than the main (64-bit) compiler
@@ -53,6 +55,7 @@ endif
 VDSO_CAFLAGS += -fPIC -fno-builtin -fno-stack-protector
 VDSO_CAFLAGS += -DDISABLE_BRANCH_PROFILING
 
+
 # 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).
@@ -89,6 +92,12 @@ VDSO_CFLAGS += -Wno-int-to-pointer-cast
 VDSO_AFLAGS := $(VDSO_CAFLAGS)
 VDSO_AFLAGS += -D__ASSEMBLY__
 
+# Check for binutils support for dmb ishld
+dmbinstr := $(call cc32-as-instr,dmb ishld,-DCONFIG_AS_DMB_ISHLD=1)
+
+VDSO_CFLAGS += $(dmbinstr)
+VDSO_AFLAGS += $(dmbinstr)
+
 VDSO_LDFLAGS := $(VDSO_CPPFLAGS)
 # From arm vDSO Makefile
 VDSO_LDFLAGS += -Wl,-Bsymbolic -Wl,--no-undefined -Wl,-soname=linux-vdso.so.1
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 3/6] arm64: Remove gettimeofday.S
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 2/6] arm64: vdso32: Detect binutils support for dmb ishld Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 4/6] arm64: vdso32: Remove jump label config option in Makefile Vincenzo Frascino
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

gettimeofday.S was originally removed with the introduction of the
support for Unified vDSOs in arm64 and replaced with the C
implementation.

The file seems again present in the repository due to a side effect of
rebase.

Remove the file again.

Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/kernel/vdso/gettimeofday.S | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 arch/arm64/kernel/vdso/gettimeofday.S

diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S
deleted file mode 100644
index e69de29bb2d1..000000000000
-- 
2.23.0


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4 4/6] arm64: vdso32: Remove jump label config option in Makefile
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
                   ` (2 preceding siblings ...)
  2019-10-02 14:41 ` [PATCH v4 3/6] arm64: Remove gettimeofday.S Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 5/6] arm64: Remove vdso_datapage.h Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 6/6] lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO Vincenzo Frascino
  5 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

The jump labels are not used in vdso32 since it is not possible to run
runtime patching on them.

Remove the configuration option from the Makefile.

Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm64/kernel/vdso32/Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 77aa61340374..038357a1e835 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -38,9 +38,6 @@ VDSO_CAFLAGS += $(call cc32-option,-fno-PIE)
 ifdef CONFIG_DEBUG_INFO
 VDSO_CAFLAGS += -g
 endif
-ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(COMPATCC)), y)
-VDSO_CAFLAGS += -DCC_HAVE_ASM_GOTO
-endif
 
 # From arm Makefile
 VDSO_CAFLAGS += $(call cc32-option,-fno-dwarf2-cfi-asm)
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 5/6] arm64: Remove vdso_datapage.h
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
                   ` (3 preceding siblings ...)
  2019-10-02 14:41 ` [PATCH v4 4/6] arm64: vdso32: Remove jump label config option in Makefile Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  2019-10-02 14:41 ` [PATCH v4 6/6] lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO Vincenzo Frascino
  5 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

vdso_datapage.h  was originally removed with the introduction of the
support for Unified vDSOs in arm64 and replaced with the C
implementation.

The file seems again present in the repository due to a side effect of
rebase.

Remove the file again.

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_datapage.h | 33 --------------------------
 1 file changed, 33 deletions(-)
 delete mode 100644 arch/arm64/include/asm/vdso_datapage.h

diff --git a/arch/arm64/include/asm/vdso_datapage.h b/arch/arm64/include/asm/vdso_datapage.h
deleted file mode 100644
index 1f38bf330a6e..000000000000
--- a/arch/arm64/include/asm/vdso_datapage.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2012 ARM Limited
- */
-#ifndef __ASM_VDSO_DATAPAGE_H
-#define __ASM_VDSO_DATAPAGE_H
-
-#ifndef __ASSEMBLY__
-
-struct vdso_data {
-	__u64 cs_cycle_last;	/* Timebase at clocksource init */
-	__u64 raw_time_sec;	/* Raw time */
-	__u64 raw_time_nsec;
-	__u64 xtime_clock_sec;	/* Kernel time */
-	__u64 xtime_clock_nsec;
-	__u64 xtime_coarse_sec;	/* Coarse time */
-	__u64 xtime_coarse_nsec;
-	__u64 wtm_clock_sec;	/* Wall to monotonic time */
-	__u64 wtm_clock_nsec;
-	__u32 tb_seq_count;	/* Timebase sequence counter */
-	/* cs_* members must be adjacent and in this order (ldp accesses) */
-	__u32 cs_mono_mult;	/* NTP-adjusted clocksource multiplier */
-	__u32 cs_shift;		/* Clocksource shift (mono = raw) */
-	__u32 cs_raw_mult;	/* Raw clocksource multiplier */
-	__u32 tz_minuteswest;	/* Whacky timezone stuff */
-	__u32 tz_dsttime;
-	__u32 use_syscall;
-	__u32 hrtimer_res;
-};
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* __ASM_VDSO_DATAPAGE_H */
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v4 6/6] lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO
  2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
                   ` (4 preceding siblings ...)
  2019-10-02 14:41 ` [PATCH v4 5/6] arm64: Remove vdso_datapage.h Vincenzo Frascino
@ 2019-10-02 14:41 ` Vincenzo Frascino
  5 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-02 14:41 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel
  Cc: vincenzo.frascino, ard.biesheuvel, ndesaulniers, catalin.marinas,
	will, tglx, luto

arm64 was the last architecture using CROSS_COMPILE_COMPAT_VDSO config
option. With this patch series the dependency in the architecture has
been removed.

Remove CROSS_COMPILE_COMPAT_VDSO from the Unified vDSO library code.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 lib/vdso/Kconfig | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/lib/vdso/Kconfig b/lib/vdso/Kconfig
index cc00364bd2c2..9fe698ff62ec 100644
--- a/lib/vdso/Kconfig
+++ b/lib/vdso/Kconfig
@@ -24,13 +24,4 @@ config GENERIC_COMPAT_VDSO
 	help
 	  This config option enables the compat VDSO layer.
 
-config CROSS_COMPILE_COMPAT_VDSO
-	string "32 bit Toolchain prefix for compat vDSO"
-	default ""
-	depends on GENERIC_COMPAT_VDSO
-	help
-	  Defines the cross-compiler prefix for compiling compat vDSO.
-	  If a 64 bit compiler (i.e. x86_64) can compile the VDSO for
-	  32 bit, it does not need to define this parameter.
-
 endif
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-02 14:41 ` [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors Vincenzo Frascino
@ 2019-10-03 16:00   ` Catalin Marinas
  2019-10-03 16:16     ` Catalin Marinas
  2019-10-03 16:20     ` Vincenzo Frascino
  0 siblings, 2 replies; 12+ messages in thread
From: Catalin Marinas @ 2019-10-03 16:00 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: linux-arm-kernel, linux-kernel, ard.biesheuvel, ndesaulniers,
	will, tglx, luto

On Wed, Oct 02, 2019 at 03:41:51PM +0100, Vincenzo Frascino wrote:
> Cc: Will Deacon <will@kernel.org>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Reported-by: Will Deacon <will@kernel.org>
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Tested-by: Catalin Marinas <catalin.marinas@arm.com>

If you changed the patch, please drop my reviewed/tested-by.

> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> index 84a3d502c5a5..dfa6a5cb99e4 100644
> --- a/arch/arm64/Makefile
> +++ b/arch/arm64/Makefile
> @@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
>    endif
>  endif
>  
> +COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
> +export COMPATCC
> +
>  ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
> -  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
> -
> -  ifeq ($(CONFIG_CC_IS_CLANG), y)
> -    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
> -  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
> -    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
> -  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
> -    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
> -  else
> -    export CROSS_COMPILE_COMPAT
> -    export CONFIG_COMPAT_VDSO := y
> -    compat_vdso := -DCONFIG_COMPAT_VDSO=1
> -  endif
> +  export CONFIG_COMPAT_VDSO := y
> +  compat_vdso := -DCONFIG_COMPAT_VDSO=1
>  endif

With this change, if I don't have any CROSS_COMPILE_COMPAT in my
environment, the kernel fails to build because COMPATCC becomes gcc
which cannot build the vdso32. What I really want is not to warn me, nor
fail to build the kernel when I don't care about the compat vDSO (e.g. I
have a 64-bit only machine).

What saved us before was the COMPATCC_IS_ARM_GCC check and a selection
of the GENERIC_COMPAT_VDSO dependent on this check. This was now dropped
from the previous version of the patch. We could add something like
COMPATCC_CAN_LINK.

-- 
Catalin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-03 16:00   ` Catalin Marinas
@ 2019-10-03 16:16     ` Catalin Marinas
  2019-10-03 17:03       ` Vincenzo Frascino
  2019-10-03 17:40       ` Vincenzo Frascino
  2019-10-03 16:20     ` Vincenzo Frascino
  1 sibling, 2 replies; 12+ messages in thread
From: Catalin Marinas @ 2019-10-03 16:16 UTC (permalink / raw)
  To: Vincenzo Frascino
  Cc: ard.biesheuvel, ndesaulniers, linux-kernel, luto, tglx, will,
	linux-arm-kernel

On Thu, Oct 03, 2019 at 05:00:41PM +0100, Catalin Marinas wrote:
> On Wed, Oct 02, 2019 at 03:41:51PM +0100, Vincenzo Frascino wrote:
> > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
> > index 84a3d502c5a5..dfa6a5cb99e4 100644
> > --- a/arch/arm64/Makefile
> > +++ b/arch/arm64/Makefile
> > @@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
> >    endif
> >  endif
> >  
> > +COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
> > +export COMPATCC
> > +
> >  ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
> > -  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
> > -
> > -  ifeq ($(CONFIG_CC_IS_CLANG), y)
> > -    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
> > -  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
> > -    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
> > -  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
> > -    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
> > -  else
> > -    export CROSS_COMPILE_COMPAT
> > -    export CONFIG_COMPAT_VDSO := y
> > -    compat_vdso := -DCONFIG_COMPAT_VDSO=1
> > -  endif
> > +  export CONFIG_COMPAT_VDSO := y
> > +  compat_vdso := -DCONFIG_COMPAT_VDSO=1
> >  endif
> 
> With this change, if I don't have any CROSS_COMPILE_COMPAT in my
> environment, the kernel fails to build because COMPATCC becomes gcc
> which cannot build the vdso32. What I really want is not to warn me, nor
> fail to build the kernel when I don't care about the compat vDSO (e.g. I
> have a 64-bit only machine).
> 
> What saved us before was the COMPATCC_IS_ARM_GCC check and a selection
> of the GENERIC_COMPAT_VDSO dependent on this check. This was now dropped
> from the previous version of the patch. We could add something like
> COMPATCC_CAN_LINK.

Ah, the COMPATCC_CAN_LINK idea doesn't help because an x86 gcc can still
link. Maybe only enable CONFIG_COMPAT_VDSO above if CROSS_COMPILE_COMPAT
was set. You could move the COMPATCC setting and export under the
same 'if' block in the Makefile.

-- 
Catalin

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-03 16:00   ` Catalin Marinas
  2019-10-03 16:16     ` Catalin Marinas
@ 2019-10-03 16:20     ` Vincenzo Frascino
  1 sibling, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-03 16:20 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: linux-arm-kernel, linux-kernel, ard.biesheuvel, ndesaulniers,
	will, tglx, luto

[-- Attachment #1: Type: text/plain, Size: 2413 bytes --]

On 03/10/2019 17:00, Catalin Marinas wrote:
> On Wed, Oct 02, 2019 at 03:41:51PM +0100, Vincenzo Frascino wrote:
>> Cc: Will Deacon <will@kernel.org>
>> Cc: Catalin Marinas <catalin.marinas@arm.com>
>> Reported-by: Will Deacon <will@kernel.org>
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
>> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
>> Tested-by: Catalin Marinas <catalin.marinas@arm.com>
> 
> If you changed the patch, please drop my reviewed/tested-by.
>

Sorry, forgot it in this patch.

>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>> index 84a3d502c5a5..dfa6a5cb99e4 100644
>> --- a/arch/arm64/Makefile
>> +++ b/arch/arm64/Makefile
>> @@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
>>    endif
>>  endif
>>  
>> +COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
>> +export COMPATCC
>> +
>>  ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
>> -  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
>> -
>> -  ifeq ($(CONFIG_CC_IS_CLANG), y)
>> -    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
>> -  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
>> -    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
>> -  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
>> -    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
>> -  else
>> -    export CROSS_COMPILE_COMPAT
>> -    export CONFIG_COMPAT_VDSO := y
>> -    compat_vdso := -DCONFIG_COMPAT_VDSO=1
>> -  endif
>> +  export CONFIG_COMPAT_VDSO := y
>> +  compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>  endif
> 
> With this change, if I don't have any CROSS_COMPILE_COMPAT in my
> environment, the kernel fails to build because COMPATCC becomes gcc
> which cannot build the vdso32. What I really want is not to warn me, nor
> fail to build the kernel when I don't care about the compat vDSO (e.g. I
> have a 64-bit only machine).
> 
> What saved us before was the COMPATCC_IS_ARM_GCC check and a selection
> of the GENERIC_COMPAT_VDSO dependent on this check. This was now dropped
> from the previous version of the patch. We could add something like
> COMPATCC_CAN_LINK.
> 

Seems not solving the problem, I am trying with COMPATCC_EMPTY as test -z
$CROSS_COMPILER_COMPAT.

-- 
Regards,
Vincenzo

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 14291 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-03 16:16     ` Catalin Marinas
@ 2019-10-03 17:03       ` Vincenzo Frascino
  2019-10-03 17:40       ` Vincenzo Frascino
  1 sibling, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-03 17:03 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: ard.biesheuvel, ndesaulniers, linux-kernel, luto, tglx, will,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2568 bytes --]



On 03/10/2019 17:16, Catalin Marinas wrote:
> On Thu, Oct 03, 2019 at 05:00:41PM +0100, Catalin Marinas wrote:
>> On Wed, Oct 02, 2019 at 03:41:51PM +0100, Vincenzo Frascino wrote:
>>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>>> index 84a3d502c5a5..dfa6a5cb99e4 100644
>>> --- a/arch/arm64/Makefile
>>> +++ b/arch/arm64/Makefile
>>> @@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
>>>    endif
>>>  endif
>>>  
>>> +COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
>>> +export COMPATCC
>>> +
>>>  ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
>>> -  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
>>> -
>>> -  ifeq ($(CONFIG_CC_IS_CLANG), y)
>>> -    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
>>> -  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
>>> -    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
>>> -  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
>>> -    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
>>> -  else
>>> -    export CROSS_COMPILE_COMPAT
>>> -    export CONFIG_COMPAT_VDSO := y
>>> -    compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>> -  endif
>>> +  export CONFIG_COMPAT_VDSO := y
>>> +  compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>>  endif
>>
>> With this change, if I don't have any CROSS_COMPILE_COMPAT in my
>> environment, the kernel fails to build because COMPATCC becomes gcc
>> which cannot build the vdso32. What I really want is not to warn me, nor
>> fail to build the kernel when I don't care about the compat vDSO (e.g. I
>> have a 64-bit only machine).
>>
>> What saved us before was the COMPATCC_IS_ARM_GCC check and a selection
>> of the GENERIC_COMPAT_VDSO dependent on this check. This was now dropped
>> from the previous version of the patch. We could add something like
>> COMPATCC_CAN_LINK.
> 
> Ah, the COMPATCC_CAN_LINK idea doesn't help because an x86 gcc can still
> link. Maybe only enable CONFIG_COMPAT_VDSO above if CROSS_COMPILE_COMPAT
> was set. You could move the COMPATCC setting and export under the
> same 'if' block in the Makefile.
> 

Right, I did not see this before my previous reply.

If I do that I get what follows, still investigating:

make[1]: Entering directory '/data1/Projects/LinuxKernel/linux-out'
$CROSS_COMPILE_COMPAT is []
  CLEAN   arch/arm64/crypto
  CLEAN   arch/arm64/kernel/vdso
/bin/sh: 0: Illegal option -r



-- 
Regards,
Vincenzo

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 14291 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors.
  2019-10-03 16:16     ` Catalin Marinas
  2019-10-03 17:03       ` Vincenzo Frascino
@ 2019-10-03 17:40       ` Vincenzo Frascino
  1 sibling, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2019-10-03 17:40 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: ard.biesheuvel, ndesaulniers, linux-kernel, luto, tglx, will,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 3206 bytes --]

Hi Catalin,

On 03/10/2019 17:16, Catalin Marinas wrote:
> On Thu, Oct 03, 2019 at 05:00:41PM +0100, Catalin Marinas wrote:
>> On Wed, Oct 02, 2019 at 03:41:51PM +0100, Vincenzo Frascino wrote:
>>> diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
>>> index 84a3d502c5a5..dfa6a5cb99e4 100644
>>> --- a/arch/arm64/Makefile
>>> +++ b/arch/arm64/Makefile
>>> @@ -53,20 +53,12 @@ $(warning Detected assembler with broken .inst; disassembly will be unreliable)
>>>    endif
>>>  endif
>>>  
>>> +COMPATCC ?= $(CROSS_COMPILE_COMPAT)gcc
>>> +export COMPATCC
>>> +
>>>  ifeq ($(CONFIG_GENERIC_COMPAT_VDSO), y)
>>> -  CROSS_COMPILE_COMPAT ?= $(CONFIG_CROSS_COMPILE_COMPAT_VDSO:"%"=%)
>>> -
>>> -  ifeq ($(CONFIG_CC_IS_CLANG), y)
>>> -    $(warning CROSS_COMPILE_COMPAT is clang, the compat vDSO will not be built)
>>> -  else ifeq ($(strip $(CROSS_COMPILE_COMPAT)),)
>>> -    $(warning CROSS_COMPILE_COMPAT not defined or empty, the compat vDSO will not be built)
>>> -  else ifeq ($(shell which $(CROSS_COMPILE_COMPAT)gcc 2> /dev/null),)
>>> -    $(error $(CROSS_COMPILE_COMPAT)gcc not found, check CROSS_COMPILE_COMPAT)
>>> -  else
>>> -    export CROSS_COMPILE_COMPAT
>>> -    export CONFIG_COMPAT_VDSO := y
>>> -    compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>> -  endif
>>> +  export CONFIG_COMPAT_VDSO := y
>>> +  compat_vdso := -DCONFIG_COMPAT_VDSO=1
>>>  endif
>>
>> With this change, if I don't have any CROSS_COMPILE_COMPAT in my
>> environment, the kernel fails to build because COMPATCC becomes gcc
>> which cannot build the vdso32. What I really want is not to warn me, nor
>> fail to build the kernel when I don't care about the compat vDSO (e.g. I
>> have a 64-bit only machine).
>>
>> What saved us before was the COMPATCC_IS_ARM_GCC check and a selection
>> of the GENERIC_COMPAT_VDSO dependent on this check. This was now dropped
>> from the previous version of the patch. We could add something like
>> COMPATCC_CAN_LINK.
> 
> Ah, the COMPATCC_CAN_LINK idea doesn't help because an x86 gcc can still
> link. Maybe only enable CONFIG_COMPAT_VDSO above if CROSS_COMPILE_COMPAT
> was set. You could move the COMPATCC setting and export under the
> same 'if' block in the Makefile.
> 

The snippet below the scissors solves the problem for me. I am going to re-post
a new version of the patches that contains it.

--->8---

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 37c610963eee..b4cc8fb5344c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -110,7 +110,7 @@ config ARM64
 	select GENERIC_STRNLEN_USER
 	select GENERIC_TIME_VSYSCALL
 	select GENERIC_GETTIMEOFDAY
-	select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT)
+	select GENERIC_COMPAT_VDSO if (!CPU_BIG_ENDIAN && COMPAT && !COMPATCC_EMPTY)
 	select HANDLE_DOMAIN_IRQ
 	select HARDIRQS_SW_RESEND
 	select HAVE_PCI
@@ -313,6 +313,9 @@ config KASAN_SHADOW_OFFSET
 	default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
 	default 0xffffffffffffffff

+config COMPATCC_EMPTY
+	def_bool $(success,test -z "${CROSS_COMPILE_COMPAT}")
+
 source "arch/arm64/Kconfig.platforms"

 menu "Kernel Features"


-- 
Regards,
Vincenzo

[-- Attachment #2: pEpkey.asc --]
[-- Type: application/pgp-keys, Size: 14291 bytes --]

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-10-03 17:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02 14:41 [PATCH v4 0/6] arm64: vdso32: Address various issues Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 1/6] arm64: vdso32: Fix syncconfig errors Vincenzo Frascino
2019-10-03 16:00   ` Catalin Marinas
2019-10-03 16:16     ` Catalin Marinas
2019-10-03 17:03       ` Vincenzo Frascino
2019-10-03 17:40       ` Vincenzo Frascino
2019-10-03 16:20     ` Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 2/6] arm64: vdso32: Detect binutils support for dmb ishld Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 3/6] arm64: Remove gettimeofday.S Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 4/6] arm64: vdso32: Remove jump label config option in Makefile Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 5/6] arm64: Remove vdso_datapage.h Vincenzo Frascino
2019-10-02 14:41 ` [PATCH v4 6/6] lib: vdso: Remove CROSS_COMPILE_COMPAT_VDSO Vincenzo Frascino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).