[PATCH 0/5] MIPS: Select the R10000 LL/SC workaround at boot

From: Imre Kaloz

Date: Mon Oct 26 2026 - 09:50:06 EST


Kernels for IP27, IP28 and IP30 select CONFIG_WAR_R10000_LLSC, which
retries ll/sc sequences with a branch-likely that only R10000s before
revision 3.0 need. On an R12000 Octane, dropping it makes fork, pipe,
futex and file creation 1-4% faster.

This series keeps it built in and decides at boot. Unless an affected
CPU is present, sc branches become beqz, modules are patched at load,
and tlbex and the BPF JIT emit beqz.

Patch 3 conflicts in context with the IP35 series' "MIPS: SGI-IP27:
give each CPU its own topology package id"; it resolves in one line.

Patch 5 depends on patch 2, so I'd like the whole series to go through
the MIPS tree, with an Acked-by from the BPF maintainers on patch 5.

Tested on an R12000 Octane, and the BPF JIT with test_bpf on QEMU
64-bit Malta. No R10000 before revision 3.0 was available.

Imre Kaloz (5):
MIPS: Use SC_BEQZ in the futex and sysmips ll/sc loops
MIPS: Select the R10000 LL/SC workaround at boot
MIPS: SGI-IP27: Report all CPUs to the R10000 LL/SC workaround
MIPS: tlbex: Follow the boot-time R10000 LL/SC choice
bpf, mips: Follow the boot-time R10000 LL/SC choice

arch/mips/Kconfig | 5 +-
arch/mips/include/asm/asm.h | 7 +-
arch/mips/include/asm/futex.h | 5 +-
arch/mips/include/asm/r10k-llsc.h | 29 ++++++++
arch/mips/kernel/Makefile | 1 +
arch/mips/kernel/module.c | 5 ++
arch/mips/kernel/r10k-llsc.c | 111 ++++++++++++++++++++++++++++++
arch/mips/kernel/setup.c | 2 +
arch/mips/kernel/smp.c | 2 +
arch/mips/kernel/syscall.c | 2 +-
arch/mips/kernel/vmlinux.lds.S | 8 +++
arch/mips/mm/tlbex.c | 3 +-
arch/mips/net/bpf_jit_comp.c | 5 +-
arch/mips/net/bpf_jit_comp.h | 12 ++--
arch/mips/net/bpf_jit_comp32.c | 1 +
arch/mips/net/bpf_jit_comp64.c | 5 +-
arch/mips/sgi-ip27/ip27-smp.c | 2 +
17 files changed, 188 insertions(+), 17 deletions(-)
create mode 100644 arch/mips/include/asm/r10k-llsc.h
create mode 100644 arch/mips/kernel/r10k-llsc.c


base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
--
2.47.3