diff mbox series

[v5,08/10] arm64: lse: Make ARM64_LSE_ATOMICS depend on JUMP_LABEL

Message ID 20190829154834.26547-9-will@kernel.org (mailing list archive)
State New, archived
Headers show
Series arm64: avoid out-of-line ll/sc atomics | expand

Commit Message

Will Deacon Aug. 29, 2019, 3:48 p.m. UTC
Support for LSE atomic instructions (CONFIG_ARM64_LSE_ATOMICS) relies on
a static key to select between the legacy LL/SC implementation which is
available on all arm64 CPUs and the super-duper LSE implementation which
is available on CPUs implementing v8.1 and later.

Unfortunately, when building a kernel with CONFIG_JUMP_LABEL disabled
(e.g. because the toolchain doesn't support 'asm goto'), the static key
inside the atomics code tries to use atomics itself. This results in a
mess of circular includes and a build failure:

In file included from ./arch/arm64/include/asm/lse.h:11,
                 from ./arch/arm64/include/asm/atomic.h:16,
                 from ./include/linux/atomic.h:7,
                 from ./include/asm-generic/bitops/atomic.h:5,
                 from ./arch/arm64/include/asm/bitops.h:26,
                 from ./include/linux/bitops.h:19,
                 from ./include/linux/kernel.h:12,
                 from ./include/asm-generic/bug.h:18,
                 from ./arch/arm64/include/asm/bug.h:26,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/page-flags.h:10,
                 from kernel/bounds.c:10:
./include/linux/jump_label.h: In function ‘static_key_count’:
./include/linux/jump_label.h:254:9: error: implicit declaration of function ‘atomic_read’ [-Werror=implicit-function-declaration]
  return atomic_read(&key->enabled);
         ^~~~~~~~~~~

[ ... more of the same ... ]

Since LSE atomic instructions are not critical to the operation of the
kernel, make them depend on JUMP_LABEL at compile time.

Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Andrew Murray Aug. 29, 2019, 11:44 p.m. UTC | #1
On Thu, Aug 29, 2019 at 04:48:32PM +0100, Will Deacon wrote:
> Support for LSE atomic instructions (CONFIG_ARM64_LSE_ATOMICS) relies on
> a static key to select between the legacy LL/SC implementation which is
> available on all arm64 CPUs and the super-duper LSE implementation which
> is available on CPUs implementing v8.1 and later.
> 
> Unfortunately, when building a kernel with CONFIG_JUMP_LABEL disabled
> (e.g. because the toolchain doesn't support 'asm goto'), the static key
> inside the atomics code tries to use atomics itself. This results in a
> mess of circular includes and a build failure:
> 
> In file included from ./arch/arm64/include/asm/lse.h:11,
>                  from ./arch/arm64/include/asm/atomic.h:16,
>                  from ./include/linux/atomic.h:7,
>                  from ./include/asm-generic/bitops/atomic.h:5,
>                  from ./arch/arm64/include/asm/bitops.h:26,
>                  from ./include/linux/bitops.h:19,
>                  from ./include/linux/kernel.h:12,
>                  from ./include/asm-generic/bug.h:18,
>                  from ./arch/arm64/include/asm/bug.h:26,
>                  from ./include/linux/bug.h:5,
>                  from ./include/linux/page-flags.h:10,
>                  from kernel/bounds.c:10:
> ./include/linux/jump_label.h: In function ‘static_key_count’:
> ./include/linux/jump_label.h:254:9: error: implicit declaration of function ‘atomic_read’ [-Werror=implicit-function-declaration]
>   return atomic_read(&key->enabled);
>          ^~~~~~~~~~~
> 
> [ ... more of the same ... ]
> 
> Since LSE atomic instructions are not critical to the operation of the
> kernel, make them depend on JUMP_LABEL at compile time.
> 
> Signed-off-by: Will Deacon <will@kernel.org>
> ---

Reviewed-by: Andrew Murray <andrew.murray@arm.com>

>  arch/arm64/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 3adcec05b1f6..27405ac94228 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1263,6 +1263,7 @@ config ARM64_PAN
>  
>  config ARM64_LSE_ATOMICS
>  	bool "Atomic instructions"
> +	depends on JUMP_LABEL
>  	default y
>  	help
>  	  As part of the Large System Extensions, ARMv8.1 introduces new
> -- 
> 2.11.0
>
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 3adcec05b1f6..27405ac94228 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1263,6 +1263,7 @@  config ARM64_PAN
 
 config ARM64_LSE_ATOMICS
 	bool "Atomic instructions"
+	depends on JUMP_LABEL
 	default y
 	help
 	  As part of the Large System Extensions, ARMv8.1 introduces new