Re: [PATCH] LoongArch: Only use SC.Q when supported by the assembler

From: Thomas Weißschuh

Date: Mon Mar 09 2026 - 03:07:40 EST


Hi LoongArch maintainers,

On Wed, Feb 25, 2026 at 11:09:39AM +0100, Thomas Weißschuh wrote:
> The 128-bit atomic cmpxchg implementation uses the SC.Q instruction.
> Older versions of GNU AS do not support that instruction, erroring out:
>
> ERROR:root:{standard input}: Assembler messages:
> {standard input}:4831: Error: no match insn: sc.q $t0,$t1,$r14
> {standard input}:6407: Error: no match insn: sc.q $t0,$t1,$r23
> {standard input}:10856: Error: no match insn: sc.q $t0,$t1,$r14
> make[4]: *** [../scripts/Makefile.build:289: mm/slub.o] Error 1
>
> (Binutils 2.41)
>
> Test support for SC.Q in kconfig and disable the atomics if the
> instruction is not available.
>
> Fixes: f0e4b1b6e295 ("LoongArch: Add 128-bit atomic cmpxchg support")
> Closes: https://lore.kernel.org/lkml/20260216082834-edc51c46-7b7a-4295-8ea5-4d9a3ca2224f@xxxxxxxxxxxxx/
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> ---
> arch/loongarch/Kconfig | 3 +++
> arch/loongarch/include/asm/cmpxchg.h | 5 +++++
> 2 files changed, 8 insertions(+)

(...)

This is still broken in mainline. Any chance to get this patch to Linus?


Thomas