arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y
Hello Catalin,
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency for asm/lse.h through jump_label.h:
CC arch/arm64/kernel/asm-offsets.s
In file included from ./arch/arm64/include/asm/atomic.h:34:0,
from ./include/linux/atomic.h:4,
from ./include/linux/jump_label.h:169,
from ./arch/arm64/include/asm/cpufeature.h:12,
from ./arch/arm64/include/asm/alternative.h:4,
from ./arch/arm64/include/asm/lse.h:7,
from ./arch/arm64/include/asm/spinlock.h:19,
from ./include/linux/spinlock.h:87,
from ./include/linux/seqlock.h:35,
from ./include/linux/time.h:5,
from ./include/uapi/linux/timex.h:56,
from ./include/linux/timex.h:56,
from ./include/linux/sched.h:19,
from arch/arm64/kernel/asm-offsets.c:21:./arch/arm64/include/asm/atomic_lse.h: In function ?atomic_andnot?:./arch/arm64/include/asm/atomic_lse.h:35:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN(__LL_SC_ATOMIC(op), \
...
./arch/arm64/include/asm/cmpxchg.h: In function ?__xchg_case_1?:./arch/arm64/include/asm/cmpxchg.h:38:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN( \
Signature · 2 lines
Regards, Artem
Hi Artem,
Quoted 25 lines · Artem Savkov
Hello Catalin,
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "
CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency forasm/lse.hthroughjump_label.h:CC
arch/arm64/kernel/asm-offsets.s
In file included from./arch/arm64/include/asm/atomic.h:34:0,from ./include/linux/atomic.h:4, from ./include/linux/jump_label.h:169, from ./arch/arm64/include/asm/cpufeature.h:12, from ./arch/arm64/include/asm/alternative.h:4, from ./arch/arm64/include/asm/lse.h:7, from ./arch/arm64/include/asm/spinlock.h:19, from ./include/linux/spinlock.h:87, from ./include/linux/seqlock.h:35, from ./include/linux/time.h:5, from ./include/uapi/linux/timex.h:56, from ./include/linux/timex.h:56, from ./include/linux/sched.h:19, from arch/arm64/kernel/asm-offsets.c:21:
./arch/arm64/include/asm/atomic_lse.h: In function ?atomic_andnot?:./arch/arm64/include/asm/atomic_lse.h:35:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN(__LL_SC_ATOMIC(op), \
Quoted 5 lines
...
./arch/arm64/include/asm/cmpxchg.h: In function ?__xchg_case_1?:./arch/arm64/include/asm/cmpxchg.h:38:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN( \
I'm unable to reproduce this. I've tried enabling LSE with defconfig and mainline, using compilers that both do and don't support the instructions.
What am I missing?
Will
Quoted 28 lines · Will Deacon
Hi Artem,
Quoted 25 lines · Artem Savkov
Hello Catalin,
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "
CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency forasm/lse.hthroughjump_label.h:CC
arch/arm64/kernel/asm-offsets.s
In file included from./arch/arm64/include/asm/atomic.h:34:0,from ./include/linux/atomic.h:4, from ./include/linux/jump_label.h:169, from ./arch/arm64/include/asm/cpufeature.h:12, from ./arch/arm64/include/asm/alternative.h:4, from ./arch/arm64/include/asm/lse.h:7, from ./arch/arm64/include/asm/spinlock.h:19, from ./include/linux/spinlock.h:87, from ./include/linux/seqlock.h:35, from ./include/linux/time.h:5, from ./include/uapi/linux/timex.h:56, from ./include/linux/timex.h:56, from ./include/linux/sched.h:19, from arch/arm64/kernel/asm-offsets.c:21:
./arch/arm64/include/asm/atomic_lse.h: In function ?atomic_andnot?:./arch/arm64/include/asm/atomic_lse.h:35:15: error: expected string literal before ? ?
asm volatile(ARM64_LSE_ATOMIC_INSN(__LL_SC_ATOMIC(op), \
Quoted 8 lines
Quoted 5 lines
...
./arch/arm64/include/asm/cmpxchg.h: In function ?__xchg_case_1?:./arch/arm64/include/asm/cmpxchg.h:38:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN( \I'm unable to reproduce this. I've tried enabling LSE with defconfig and mainline, using compilers that both do and don't support the instructions.
I am not able to reproduce it either. One minor problem I see with the commit could be fixed with the following change : Does it help ?
----8>-----
arch/arm64/include/asm/cpufeature.h +1 -1
@@ -9,7 +9,6 @@#ifndef __ASM_CPUFEATURE_H#define __ASM_CPUFEATURE_H -#include <linux/jump_label.h> #include <asm/hwcap.h> #include <asm/sysreg.h>
@@ -45,6 +44,7 @@#ifndef __ASSEMBLY__ +#include <linux/jump_label.h> #include <linux/kernel.h> /* CPU feature register tracking */
Suzuki
Quoted 35 lines · Suzuki K Poulose
Quoted 34 lines · Will Deacon
Hi Artem,
Quoted 30 lines · Artem Savkov
Hello Catalin,
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "
CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency forasm/lse.hthroughjump_label.h:CC
arch/arm64/kernel/asm-offsets.s
In file included from./arch/arm64/include/asm/atomic.h:34:0,from ./include/linux/atomic.h:4, from ./include/linux/jump_label.h:169, from ./arch/arm64/include/asm/cpufeature.h:12, from ./arch/arm64/include/asm/alternative.h:4, from ./arch/arm64/include/asm/lse.h:7, from ./arch/arm64/include/asm/spinlock.h:19, from ./include/linux/spinlock.h:87, from ./include/linux/seqlock.h:35, from ./include/linux/time.h:5, from ./include/uapi/linux/timex.h:56, from ./include/linux/timex.h:56, from ./include/linux/sched.h:19, from arch/arm64/kernel/asm-offsets.c:21:
./arch/arm64/include/asm/atomic_lse.h: In function ?atomic_andnot?:./arch/arm64/include/asm/atomic_lse.h:35:15: error: expected string literal before ? ?
asm volatile(ARM64_LSE_ATOMIC_INSN(__LL_SC_ATOMIC(op), \...
./arch/arm64/include/asm/cmpxchg.h: In function ?__xchg_case_1?:./arch/arm64/include/asm/cmpxchg.h:38:15: error: expected string literal before ?ARM64_LSE_ATOMIC_INSN?
asm volatile(ARM64_LSE_ATOMIC_INSN( \
Quoted 5 lines
Quoted 2 lines
I'm unable to reproduce this. I've tried enabling LSE with defconfig and mainline, using compilers that both do and don't support the instructions.
I am not able to reproduce it either. One minor problem I see with the commit could be fixed with the following change : Does it help ?
Apparently it fails with an older gcc (4.8.5), but doesn't with 6.2.0. The different bit is that with 4.8.5 I don't have CC_HAVE_ASM_GOTO set. It is reproducible with 6.2.0 if you manually remove CC_HAVE_ASM_GOTO.
Quoted 13 lines
----8>-----
arch/arm64/include/asm/cpufeature.h +0
-1@@ -9,7 +9,6 @@#ifndef __ASM_CPUFEATURE_H#define __ASM_CPUFEATURE_H -#include <linux/jump_label.h> #include <asm/hwcap.h> #include <asm/sysreg.h>
arch/arm64/include/asm/cpufeature.h line 47
Quoted 4 lines
arch/arm64/include/asm/cpufeature.h +1
-0@@ -45,6 +44,7 @@#ifndef __ASSEMBLY__ +#include <linux/jump_label.h> #include <linux/kernel.h> /* CPU feature register tracking */
No, this doesn't help.
Signature · 2 lines
Regards, Artem
Catalin Marinas
maintainerQuoted 6 lines · Artem Savkov
Quoted 5 lines · Suzuki K Poulose
Quoted 4 lines · Will Deacon
Quoted 3 lines · Artem Savkov
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "
CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency forasm/lse.hthroughjump_label.h:
[...]
Quoted 3 lines
Apparently it fails with an older gcc (4.8.5), but doesn't with 6.2.0. The different bit is that with 4.8.5 I don't have
CC_HAVE_ASM_GOTOset. It is reproducible with 6.2.0 if you manually removeCC_HAVE_ASM_GOTO.
-----------8<----------------
Quoted 1 line
From
e27eb40cd5af38f1a5e64553a367220f00a1b5d8Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Thu, 3 Nov 2016 18:34:34 +0000
Subject: [PATCH] arm64: Fix circular include of asm/lse.h through
linux/jump_label.h
Commit efd9e03facd0 ("arm64: Use static keys for CPU features") introduced support for static keys in asm/cpufeature.h, including linux/jump_label.h. When CC_HAVE_ASM_GOTO is not defined, this causes a circular dependency via linux/atomic.h, asm/lse.h and asm/cpufeature.h.
This patch moves the capability macros out out of asm/cpufeature.h into a separate asm/cpucaps.h and modifies some of the #includes accordingly.
--- arch/arm64/include/asm/alternative.h | 2 +- arch/arm64/include/asm/cpucaps.h | 40 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/cpufeature.h | 20 +----------------- arch/arm64/include/asm/lse.h | 1 - 4 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 arch/arm64/include/asm/cpucaps.h
arch/arm64/include/asm/alternative.h +1 -1
@@ -1,7 +1,7 @@#ifndef __ASM_ALTERNATIVE_H#define __ASM_ALTERNATIVE_H -#include <asm/cpufeature.h> +#include <asm/cpucaps.h> #include <asm/insn.h> #ifndef __ASSEMBLY__
arch/arm64/include/asm/cpucaps.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* arch/arm64/include/asm/cpucaps.h +* +* Copyright (C) 2016 ARM Ltd. +* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef __ASM_CPUCAPS_H +#define __ASM_CPUCAPS_H + +#define ARM64_WORKAROUND_CLEAN_CACHE 0 +#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 +#define ARM64_WORKAROUND_845719 2 +#define ARM64_HAS_SYSREG_GIC_CPUIF 3 +#define ARM64_HAS_PAN 4 +#define ARM64_HAS_LSE_ATOMICS 5 +#define ARM64_WORKAROUND_CAVIUM_23154 6 +#define ARM64_WORKAROUND_834220 7 +#define ARM64_HAS_NO_HW_PREFETCH 8 +#define ARM64_HAS_UAO 9 +#define ARM64_ALT_PAN_NOT_UAO 10 +#define ARM64_HAS_VIRT_HOST_EXTN 11 +#define ARM64_WORKAROUND_CAVIUM_27456 12 +#define ARM64_HAS_32BIT_EL0 13 +#define ARM64_HYP_OFFSET_LOW 14 +#define ARM64_MISMATCHED_CACHE_LINE_SIZE 15 + +#define ARM64_NCAPS 16 + +#endif /* __ASM_CPUCAPS_H */
arch/arm64/include/asm/cpufeature.h +1 -19
@@ -11,6 +11,7 @@#include <linux/jump_label.h> +#include <asm/cpucaps.h> #include <asm/hwcap.h> #include <asm/sysreg.h>
@@ -24,25 +25,6 @@#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))#define cpu_feature (x) ilog2(HWCAP_ ## x) -#define ARM64_WORKAROUND_CLEAN_CACHE 0 -#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 -#define ARM64_WORKAROUND_845719 2 -#define ARM64_HAS_SYSREG_GIC_CPUIF 3 -#define ARM64_HAS_PAN 4 -#define ARM64_HAS_LSE_ATOMICS 5 -#define ARM64_WORKAROUND_CAVIUM_23154 6 -#define ARM64_WORKAROUND_834220 7 -#define ARM64_HAS_NO_HW_PREFETCH 8 -#define ARM64_HAS_UAO 9 -#define ARM64_ALT_PAN_NOT_UAO 10 -#define ARM64_HAS_VIRT_HOST_EXTN 11 -#define ARM64_WORKAROUND_CAVIUM_27456 12 -#define ARM64_HAS_32BIT_EL0 13 -#define ARM64_HYP_OFFSET_LOW 14 -#define ARM64_MISMATCHED_CACHE_LINE_SIZE 15 - -#define ARM64_NCAPS 16 -#ifndef __ASSEMBLY__#include <linux/kernel.h>
arch/arm64/include/asm/lse.h +0 -1
@@ -5,7 +5,6 @@#include <linux/stringify.h> #include <asm/alternative.h> -#include <asm/cpufeature.h> #ifdef __ASSEMBLER__
Signature · 1 line
Catalin
Artem Savkov
Tested-byQuoted 30 lines · Catalin Marinas
Quoted 6 lines · Artem Savkov
Quoted 5 lines · Suzuki K Poulose
Quoted 4 lines · Will Deacon
Quoted 3 lines · Artem Savkov
Looks like your patch "efd9e03 arm64: Use static keys for CPU features" breaks arm64 build with "
CONFIG_ARM64_LSE_ATOMICS=y" because it creates a circular dependency forasm/lse.hthroughjump_label.h:[...]
Quoted 3 lines
Apparently it fails with an older gcc (4.8.5), but doesn't with 6.2.0. The different bit is that with 4.8.5 I don't have
CC_HAVE_ASM_GOTOset. It is reproducible with 6.2.0 if you manually removeCC_HAVE_ASM_GOTO.-----------8<----------------
Frome27eb40cd5af38f1a5e64553a367220f00a1b5d8Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Thu, 3 Nov 2016 18:34:34 +0000
Subject: [PATCH] arm64: Fix circular include ofasm/lse.hthrough
linux/jump_label.hCommit
efd9e03facd0("arm64: Use static keys for CPU features") introduced support for static keys inasm/cpufeature.h, includinglinux/jump_label.h. WhenCC_HAVE_ASM_GOTOis not defined, this causes a circular dependency vialinux/atomic.h,asm/lse.handasm/cpufeature.h.This patch moves the capability macros out out of
asm/cpufeature.hinto a separateasm/cpucaps.hand modifies some of the #includes accordingly.Fixes efd9e03facd0 ("arm64: Use static keys for CPU features")Reported-by Artem Savkov <[email protected]>Signed-off-by Catalin Marinas <[email protected]>
Quoted 7 lines
--- arch/arm64/include/asm/alternative.h | 2 +- arch/arm64/include/asm/cpucaps.h | 40 ++++++++++++++++++++++++++++++++++++ arch/arm64/include/asm/cpufeature.h | 20 +----------------- arch/arm64/include/asm/lse.h | 1 - 4 files changed, 42 insertions(+), 21 deletions(-) create mode 100644 arch/arm64/include/asm/cpucaps.h
The patch fixes the issue. Thanks.
Signature · 2 lines
Regards, Artem