LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
@ 2021-08-30 21:38 Nick Desaulniers
2021-08-30 23:17 ` Thomas Gleixner
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Nick Desaulniers @ 2021-08-30 21:38 UTC (permalink / raw)
To: linux-arm-kernel
Cc: llvm, Nick Desaulniers, Arnd Bergmann, Nathan Chancellor,
Thomas Gleixner, Russell King, Geert Uytterhoeven, Linus Walleij,
Andrew Morton, Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, linux-kernel,
clang-built-linux
tglx notes:
This function [futex_detect_cmpxchg] is only needed when an
architecture has to runtime discover whether the CPU supports it or
not. ARM has unconditional support for this, so the obvious thing to
do is the below.
Fixes linkage failure from Clang randconfigs:
kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
and boot failures for CONFIG_THUMB2_KERNEL.
Link: https://github.com/ClangBuiltLinux/linux/issues/325
Reported-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
arch/arm/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..b760dd45b734 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -92,6 +92,7 @@ config ARM
select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
select HAVE_FUNCTION_TRACER if !XIP_KERNEL
+ select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_GCC_PLUGINS
select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
select HAVE_IRQ_TIME_ACCOUNTING
--
2.33.0.259.gc128427fd7-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-08-30 21:38 [PATCH] ARM: select HAVE_FUTEX_CMPXCHG Nick Desaulniers
@ 2021-08-30 23:17 ` Thomas Gleixner
2021-08-30 23:31 ` Nathan Chancellor
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2021-08-30 23:17 UTC (permalink / raw)
To: Nick Desaulniers, linux-arm-kernel
Cc: llvm, Nick Desaulniers, Arnd Bergmann, Nathan Chancellor,
Russell King, Geert Uytterhoeven, Linus Walleij, Andrew Morton,
Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, linux-kernel,
clang-built-linux
On Mon, Aug 30 2021 at 14:38, Nick Desaulniers wrote:
> tglx notes:
> This function [futex_detect_cmpxchg] is only needed when an
> architecture has to runtime discover whether the CPU supports it or
> not. ARM has unconditional support for this, so the obvious thing to
> do is the below.
>
> Fixes linkage failure from Clang randconfigs:
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> and boot failures for CONFIG_THUMB2_KERNEL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/325
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-08-30 21:38 [PATCH] ARM: select HAVE_FUTEX_CMPXCHG Nick Desaulniers
2021-08-30 23:17 ` Thomas Gleixner
@ 2021-08-30 23:31 ` Nathan Chancellor
2021-09-16 22:40 ` Linus Walleij
2021-09-17 7:11 ` Arnd Bergmann
3 siblings, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2021-08-30 23:31 UTC (permalink / raw)
To: Nick Desaulniers
Cc: linux-arm-kernel, llvm, Arnd Bergmann, Thomas Gleixner,
Russell King, Geert Uytterhoeven, Linus Walleij, Andrew Morton,
Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, linux-kernel,
clang-built-linux
On Mon, Aug 30, 2021 at 02:38:43PM -0700, Nick Desaulniers wrote:
> tglx notes:
> This function [futex_detect_cmpxchg] is only needed when an
> architecture has to runtime discover whether the CPU supports it or
> not. ARM has unconditional support for this, so the obvious thing to
> do is the below.
>
> Fixes linkage failure from Clang randconfigs:
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> and boot failures for CONFIG_THUMB2_KERNEL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/325
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
> ---
> arch/arm/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..b760dd45b734 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -92,6 +92,7 @@ config ARM
> select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
> select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> + select HAVE_FUTEX_CMPXCHG if FUTEX
> select HAVE_GCC_PLUGINS
> select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> select HAVE_IRQ_TIME_ACCOUNTING
> --
> 2.33.0.259.gc128427fd7-goog
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-08-30 21:38 [PATCH] ARM: select HAVE_FUTEX_CMPXCHG Nick Desaulniers
2021-08-30 23:17 ` Thomas Gleixner
2021-08-30 23:31 ` Nathan Chancellor
@ 2021-09-16 22:40 ` Linus Walleij
2021-09-16 23:26 ` Nick Desaulniers
2021-09-17 7:11 ` Arnd Bergmann
3 siblings, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2021-09-16 22:40 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Linux ARM, llvm, Arnd Bergmann, Nathan Chancellor,
Thomas Gleixner, Russell King, Geert Uytterhoeven, Andrew Morton,
Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, linux-kernel,
clang-built-linux
On Mon, Aug 30, 2021 at 11:38 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
> tglx notes:
> This function [futex_detect_cmpxchg] is only needed when an
> architecture has to runtime discover whether the CPU supports it or
> not. ARM has unconditional support for this, so the obvious thing to
> do is the below.
>
> Fixes linkage failure from Clang randconfigs:
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> and boot failures for CONFIG_THUMB2_KERNEL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/325
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
LGTM
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Please put this into Russell's patch tracker!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-09-16 22:40 ` Linus Walleij
@ 2021-09-16 23:26 ` Nick Desaulniers
0 siblings, 0 replies; 7+ messages in thread
From: Nick Desaulniers @ 2021-09-16 23:26 UTC (permalink / raw)
To: Linus Walleij
Cc: Linux ARM, llvm, Arnd Bergmann, Nathan Chancellor,
Thomas Gleixner, Russell King, Geert Uytterhoeven, Andrew Morton,
Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, linux-kernel,
clang-built-linux
On Thu, Sep 16, 2021 at 3:40 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Mon, Aug 30, 2021 at 11:38 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
>
> > tglx notes:
> > This function [futex_detect_cmpxchg] is only needed when an
> > architecture has to runtime discover whether the CPU supports it or
> > not. ARM has unconditional support for this, so the obvious thing to
> > do is the below.
> >
> > Fixes linkage failure from Clang randconfigs:
> > kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> > and boot failures for CONFIG_THUMB2_KERNEL.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/325
> > Reported-by: Arnd Bergmann <arnd@arndb.de>
> > Reported-by: Nathan Chancellor <nathan@kernel.org>
> > Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>
> LGTM
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Please put this into Russell's patch tracker!
Done!
https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9122/1
Thanks for the review!
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-08-30 21:38 [PATCH] ARM: select HAVE_FUTEX_CMPXCHG Nick Desaulniers
` (2 preceding siblings ...)
2021-09-16 22:40 ` Linus Walleij
@ 2021-09-17 7:11 ` Arnd Bergmann
2021-09-17 20:33 ` Arnd Bergmann
3 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2021-09-17 7:11 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Linux ARM, llvm, Arnd Bergmann, Nathan Chancellor,
Thomas Gleixner, Russell King, Geert Uytterhoeven, Linus Walleij,
Andrew Morton, Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, Linux Kernel Mailing List,
clang-built-linux
On Mon, Aug 30, 2021 at 11:38 PM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@googlegroups.com> wrote:
>
> tglx notes:
> This function [futex_detect_cmpxchg] is only needed when an
> architecture has to runtime discover whether the CPU supports it or
> not. ARM has unconditional support for this, so the obvious thing to
> do is the below.
>
> Fixes linkage failure from Clang randconfigs:
> kernel/futex.o:(.text.fixup+0x5c): relocation truncated to fit: R_ARM_JUMP24 against `.init.text'
> and boot failures for CONFIG_THUMB2_KERNEL.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/325
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Nathan Chancellor <nathan@kernel.org>
> Suggested-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
Nice! I did remember that we had come up with a number of solutions
for the build error and that at least one of them was an obvious and
nice fix, but I could never figure out what it was. This is clearly better
than any of the other ones I had found when I last looked.
I would add a reference to the commit that introduced the conditional,
and a request for backports as well:
See-also: 03b8c7b623c8 ("futex: Allow architectures to skip
futex_atomic_cmpxchg_inatomic() test")
Cc: stable@vger.kernel.org # v3.14+
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ARM: select HAVE_FUTEX_CMPXCHG
2021-09-17 7:11 ` Arnd Bergmann
@ 2021-09-17 20:33 ` Arnd Bergmann
0 siblings, 0 replies; 7+ messages in thread
From: Arnd Bergmann @ 2021-09-17 20:33 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Nick Desaulniers, Linux ARM, llvm, Nathan Chancellor,
Thomas Gleixner, Russell King, Geert Uytterhoeven, Linus Walleij,
Andrew Morton, Anshuman Khandual, Ard Biesheuvel, YiFei Zhu,
Uwe Kleine-König, Mike Rapoport, Linux Kernel Mailing List,
clang-built-linux
On Fri, Sep 17, 2021 at 9:11 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> Nice! I did remember that we had come up with a number of solutions
> for the build error and that at least one of them was an obvious and
> nice fix, but I could never figure out what it was. This is clearly better
> than any of the other ones I had found when I last looked.
Actually it turns out that I had come up with another approach, removing
the need for HAVE_FUTEX_CMPXCHG and the boot time check altogether:
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?h=randconfig-5.13&id=7bbd7403526a2a9f398f360fcb97f256052ca6bf
Guo Ren fixed the missing csky bit in there, but since the sparc32 support
is still missing, I never sent this before forgetting about it.
I think the only users of sparc32 these days are LEON CPUs, which have
usable atomics and could implement this properly but support for that was
not upstreamed.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-17 20:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 21:38 [PATCH] ARM: select HAVE_FUTEX_CMPXCHG Nick Desaulniers
2021-08-30 23:17 ` Thomas Gleixner
2021-08-30 23:31 ` Nathan Chancellor
2021-09-16 22:40 ` Linus Walleij
2021-09-16 23:26 ` Nick Desaulniers
2021-09-17 7:11 ` Arnd Bergmann
2021-09-17 20:33 ` Arnd Bergmann
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).