Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1513966 > unrolled thread

arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y

Started byArtem Savkov <asavkov@redhat.com>
First post2016-11-02 17:50 +0100
Last post2016-11-04 09:40 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.kernel


Contents

  arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Artem Savkov <asavkov@redhat.com> - 2016-11-02 17:50 +0100
    Re: arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Will Deacon <will.deacon@arm.com> - 2016-11-03 00:30 +0100
      Re: arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Suzuki K Poulose <Suzuki.Poulose@arm.com> - 2016-11-03 11:40 +0100
        Re: arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Artem Savkov <asavkov@redhat.com> - 2016-11-03 12:20 +0100
          Re: arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Catalin Marinas <catalin.marinas@arm.com> - 2016-11-03 19:50 +0100
            Re: arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y Artem Savkov <asavkov@redhat.com> - 2016-11-04 09:40 +0100

#1513966 — arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y

FromArtem Savkov <asavkov@redhat.com>
Date2016-11-02 17:50 +0100
Subjectarm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y
Message-ID<sz6TE-jL-21@gated-at.bofh.it>
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(    \

-- 
Regards,
  Artem

[toc] | [next] | [standalone]


#1514203

FromWill Deacon <will.deacon@arm.com>
Date2016-11-03 00:30 +0100
Message-ID<szd8K-4nE-3@gated-at.bofh.it>
In reply to#1513966
Hi Artem,

On Wed, Nov 02, 2016 at 05:44:27PM +0100, Artem Savkov wrote:
> 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(    \

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

[toc] | [prev] | [next] | [standalone]


#1514445

FromSuzuki K Poulose <Suzuki.Poulose@arm.com>
Date2016-11-03 11:40 +0100
Message-ID<sznB7-2Ga-9@gated-at.bofh.it>
In reply to#1514203
On 02/11/16 23:28, Will Deacon wrote:
> Hi Artem,
>
> On Wed, Nov 02, 2016 at 05:44:27PM +0100, Artem Savkov wrote:
>> 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 ‘	’
>>   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(    \
>
> 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>-----

diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index 758d74f..62db988 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -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

[toc] | [prev] | [next] | [standalone]


#1514459

FromArtem Savkov <asavkov@redhat.com>
Date2016-11-03 12:20 +0100
Message-ID<szodQ-38c-21@gated-at.bofh.it>
In reply to#1514445
On Thu, Nov 03, 2016 at 10:39:43AM +0000, Suzuki K Poulose wrote:
> On 02/11/16 23:28, Will Deacon wrote:
> > Hi Artem,
> > 
> > On Wed, Nov 02, 2016 at 05:44:27PM +0100, Artem Savkov wrote:
> > > 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 ‘	’
> > >   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(    \
> > 
> > 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.

> ----8>-----
> 
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index 758d74f..62db988 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -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 */

No, this doesn't help.

-- 
Regards,
  Artem

[toc] | [prev] | [next] | [standalone]


#1514784

FromCatalin Marinas <catalin.marinas@arm.com>
Date2016-11-03 19:50 +0100
Message-ID<szvfk-7Ee-11@gated-at.bofh.it>
In reply to#1514459
On Thu, Nov 03, 2016 at 12:12:38PM +0100, Artem Savkov wrote:
> On Thu, Nov 03, 2016 at 10:39:43AM +0000, Suzuki K Poulose wrote:
> > On 02/11/16 23:28, Will Deacon wrote:
> > > On Wed, Nov 02, 2016 at 05:44:27PM +0100, Artem Savkov wrote:
> > > > 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:
[...]
> 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.

-----------8<----------------
From e27eb40cd5af38f1a5e64553a367220f00a1b5d8 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <catalin.marinas@arm.com>
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.

Fixes: efd9e03facd0 ("arm64: Use static keys for CPU features")
Reported-by: Artem Savkov <asavkov@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 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

diff --git a/arch/arm64/include/asm/alternative.h b/arch/arm64/include/asm/alternative.h
index 39feb85a6931..6e1cb8c5af4d 100644
--- a/arch/arm64/include/asm/alternative.h
+++ b/arch/arm64/include/asm/alternative.h
@@ -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__
diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h
new file mode 100644
index 000000000000..87b446535185
--- /dev/null
+++ b/arch/arm64/include/asm/cpucaps.h
@@ -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 */
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index a27c3245ba21..0bc0b1de90c4 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -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>
diff --git a/arch/arm64/include/asm/lse.h b/arch/arm64/include/asm/lse.h
index 23acc00be32d..fc756e22c84c 100644
--- a/arch/arm64/include/asm/lse.h
+++ b/arch/arm64/include/asm/lse.h
@@ -5,7 +5,6 @@
 
 #include <linux/stringify.h>
 #include <asm/alternative.h>
-#include <asm/cpufeature.h>
 
 #ifdef __ASSEMBLER__
 

-- 
Catalin

[toc] | [prev] | [next] | [standalone]


#1515075

FromArtem Savkov <asavkov@redhat.com>
Date2016-11-04 09:40 +0100
Message-ID<szIcx-7IN-13@gated-at.bofh.it>
In reply to#1514784
On Thu, Nov 03, 2016 at 06:46:25PM +0000, Catalin Marinas wrote:
> On Thu, Nov 03, 2016 at 12:12:38PM +0100, Artem Savkov wrote:
> > On Thu, Nov 03, 2016 at 10:39:43AM +0000, Suzuki K Poulose wrote:
> > > On 02/11/16 23:28, Will Deacon wrote:
> > > > On Wed, Nov 02, 2016 at 05:44:27PM +0100, Artem Savkov wrote:
> > > > > 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:
> [...]
> > 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.
> 
> -----------8<----------------
> From e27eb40cd5af38f1a5e64553a367220f00a1b5d8 Mon Sep 17 00:00:00 2001
> From: Catalin Marinas <catalin.marinas@arm.com>
> 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.
> 
> Fixes: efd9e03facd0 ("arm64: Use static keys for CPU features")
> Reported-by: Artem Savkov <asavkov@redhat.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  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

Tested-by: Artem Savkov <asavkov@redhat.com>

The patch fixes the issue. Thanks.

-- 
Regards,
  Artem

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web