Re: [PATCH v1 05/14] futex: Add sys_futex_wake()

From: Arnd Bergmann
Date: Fri Jul 21 2023 - 11:41:51 EST


On Fri, Jul 21, 2023, at 12:22, Peter Zijlstra wrote:
> --- a/arch/arm/tools/syscall.tbl
> +++ b/arch/arm/tools/syscall.tbl
> @@ -465,3 +465,4 @@
> 449 common futex_waitv sys_futex_waitv
> 450 common set_mempolicy_home_node sys_set_mempolicy_home_node
> 451 common cachestat sys_cachestat
> +452 common futex_wake sys_futex_wake

This clashes with __NR_fchmodat2 in linux-next, which also wants number 452.

> --- a/arch/arm64/include/asm/unistd32.h
> +++ b/arch/arm64/include/asm/unistd32.h
> @@ -909,6 +909,8 @@ __SYSCALL(__NR_futex_waitv, sys_futex_wa
> __SYSCALL(__NR_set_mempolicy_home_node, sys_set_mempolicy_home_node)
> #define __NR_cachestat 451
> __SYSCALL(__NR_cachestat, sys_cachestat)
> +#define __NR_futex_wake 452
> +__SYSCALL(__NR_futex_wake, sys_futex_wake)
>
> /*
> * Please add new compat syscalls above this comment and update

Unfortunately, changing this file still requires updating __NR_compat_syscalls
in arch/arm64/include/asm/unistd.h as well.

> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -87,6 +87,7 @@ COND_SYSCALL_COMPAT(set_robust_list);
> COND_SYSCALL(get_robust_list);
> COND_SYSCALL_COMPAT(get_robust_list);
> COND_SYSCALL(futex_waitv);
> +COND_SYSCALL(futex_wake);
> COND_SYSCALL(kexec_load);
> COND_SYSCALL_COMPAT(kexec_load);
> COND_SYSCALL(init_module);

This is fine for the moment, but I wonder if we should start making
futex mandatory at some point. Right now, sparc32 with CONFIG_SMP
cannot support futex because of the lack of atomics in early
sparc processors, but sparc32 glibc actually requires futexes
and consequently only works on uniprocessor machines, on sparc64
compat mode, or on Leon3 with out of tree patches.

Arnd