diff mbox

arm64 build failure with CONFIG_ARM64_LSE_ATOMICS=y

Message ID 1efb101a-a8ab-5ad9-f2bd-e7d485c71904@arm.com
State New
Headers show

Commit Message

Suzuki K Poulose Nov. 3, 2016, 10:39 a.m. UTC
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>-----




Suzuki

Comments

Artem Savkov Nov. 3, 2016, 11:12 a.m. UTC | #1
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.
Artem Savkov Nov. 4, 2016, 8:35 a.m. UTC | #2
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.
diff mbox

Patch

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 */