mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs
@ 2026-08-07 19:34 André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 1/8] syscalls: Make --abis parsing more robust André Almeida
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

While implementing a new syscall, we need to wire up it's number to the arch
table. Since syscall number 403, all architectures are on sync regarding the
number (except alpha), which make things a lot easier but more repetitive as
well. Have a look at commit b36d4b6aa88 ("arch: hookup listns() system call"),
with 15 lines of mostly:

  +470    common  listns                          sys_listns

There's already a "common" table shared with a bunch of archs at
`scripts/syscall.tbl`, but due to historical reasons some archs will never be
able to move to this table and share all the numbers.

The generic table starts from 403 (clock_gettime64), the first common syscall.

I've compile tested for arm32, arm64, s390, mips and sparc, by comparing the
syscalls_*.h and unistd_*.h files generated before and after this patchset. For
most of cases the files are identical, for the few cases that they are not,
there's a note in the commit explaining why they are equivalent.

Thanks!
	André

Changes in v3:
- Removed x86 for now, let's wait till x32 is dropped
- Added much more archs
- v2: https://patch.msgid.link/20260727-tonyk-syscall_table-v2-0-95d4f1ee471f@igalia.com

Changes in v2:
- Managed to move to the real first common syscall: 403 (clock_gettime64)
- Added -no-compat option to be used with x86_64
- v1: https://patch.msgid.link/20260724-tonyk-syscall_table-v1-0-9c53188423da@igalia.com

---
André Almeida (8):
      syscalls: Make --abis parsing more robust
      syscalls: Create unified partial table for all archs
      scripts/syscall.tbl: Use the common table
      arm: Use the common syscall table
      s390: Use the common syscall table
      sparc: Use the common syscall table
      mips: Remove duplicated syscallnr.sh
      mips: Use the common syscall table

 arch/arm/tools/Makefile                   | 10 ++--
 arch/arm/tools/syscall.tbl                | 68 -------------------------
 arch/arm64/tools/syscall_32.tbl           | 68 -------------------------
 arch/mips/kernel/scall64-n32.S            |  1 +
 arch/mips/kernel/syscalls/Makefile        | 27 +++++++---
 arch/mips/kernel/syscalls/syscall_n32.tbl | 68 -------------------------
 arch/mips/kernel/syscalls/syscall_n64.tbl | 48 ------------------
 arch/mips/kernel/syscalls/syscall_o32.tbl | 68 -------------------------
 arch/mips/kernel/syscalls/syscallnr.sh    | 26 ----------
 arch/s390/kernel/syscalls/Makefile        |  8 ++-
 arch/s390/kernel/syscalls/syscall.tbl     | 48 ------------------
 arch/sparc/kernel/syscalls/Makefile       |  8 ++-
 arch/sparc/kernel/syscalls/syscall.tbl    | 68 -------------------------
 scripts/Makefile.asm-headers              |  9 ++--
 scripts/syscall.tbl                       | 68 -------------------------
 scripts/syscall_common.tbl                | 83 +++++++++++++++++++++++++++++++
 scripts/syscallhdr.sh                     | 62 +++++++++++++++++------
 scripts/syscalltbl.sh                     | 38 +++++++++++---
 18 files changed, 205 insertions(+), 571 deletions(-)
---
base-commit: 075b74841bd0065a3bda3440873c747938e69b68
change-id: 20260724-tonyk-syscall_table-928bbb1b26bb

Best regards,
--  
André Almeida <andrealmeid@igalia.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 1/8] syscalls: Make --abis parsing more robust
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs André Almeida
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Some archs Makefile have the something like this as the rule for making the
syscall files:

  cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@

The $* symbol is evaluated to the variable found at $(uapi)/unistd-%.h,
where % is 32 or 64, resulting in e.g. `--abis common,32`. Sometimes the
rule for the file won't have a %, resulting in a trailing comma e.g.
`--abis common,`.

Currently this input is transformed into (common|). This is problematic
because grep will then match any ABI because of the trailing `|`. Make the
syscalls scripts more robust by removing any trailing comma.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 scripts/syscallhdr.sh | 2 +-
 scripts/syscalltbl.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index 22e34cd46b9b..bad1ab606a0f 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -39,7 +39,7 @@ while [ $# -gt 0 ]
 do
 	case $1 in
 	--abis)
-		abis=$(echo "($2)" | tr ',' '|')
+		abis="($(echo "${2%,}" | tr ',' '|'))"
 		shift 2;;
 	--emit-nr)
 		emit_nr=1
diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
index 6a903b87a7c2..c4b1f85c2dd6 100755
--- a/scripts/syscalltbl.sh
+++ b/scripts/syscalltbl.sh
@@ -33,7 +33,7 @@ while [ $# -gt 0 ]
 do
 	case $1 in
 	--abis)
-		abis=$(echo "($2)" | tr ',' '|')
+		abis="($(echo "${2%,}" | tr ',' '|'))"
 		shift 2;;
 	-*)
 		echo "$1: unknown option" >&2

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 1/8] syscalls: Make --abis parsing more robust André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 20:40   ` Arnd Bergmann
  2026-08-07 19:34 ` [PATCH RFC v3 3/8] scripts/syscall.tbl: Use the common table André Almeida
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

To take advantage of the subset of syscall numbers that are guaranteed to
be shared, create a new table and adapt generation scripts to use it. In
that way, every new syscall can be added to a single file.

Create special ABIs in order to make the table work for different archs:

 - `memfd_secret` for archs that implements it
 - `cln3` for archs that use the common clone3 entry
 - `__cln3` for archs that use their own special entry point

Create flags for syscall scripts to use the common table.

Some archs only care about the native entry point and have no compat, so
create a option to never generate __SYSCALL_WITH_COMPAT() and always
generate __SYSCALL().

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 scripts/syscall_common.tbl | 83 ++++++++++++++++++++++++++++++++++++++++++++++
 scripts/syscallhdr.sh      | 60 +++++++++++++++++++++++++--------
 scripts/syscalltbl.sh      | 36 ++++++++++++++++----
 3 files changed, 158 insertions(+), 21 deletions(-)

diff --git a/scripts/syscall_common.tbl b/scripts/syscall_common.tbl
new file mode 100644
index 000000000000..decbb0c23fe3
--- /dev/null
+++ b/scripts/syscall_common.tbl
@@ -0,0 +1,83 @@
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+#
+# syscall numbers shared by all architectures
+#
+# The format is:
+# <number> <abi> <name> <entry point> [<compat entry point> [noreturn]]
+#
+# The abi can be "32", "cln3", "__cln3" and "memfd_secret"
+#
+# cln3 stands for the common clone3 entry, used by most archs. Some archs have
+# their special entry and should use "__cln3".
+#
+# "memfd_secret" is not implemented by every architecture
+
+403	32	clock_gettime64			sys_clock_gettime
+404	32	clock_settime64			sys_clock_settime
+405	32	clock_adjtime64			sys_clock_adjtime
+406	32	clock_getres_time64		sys_clock_getres
+407	32	clock_nanosleep_time64		sys_clock_nanosleep
+408	32	timer_gettime64			sys_timer_gettime
+409	32	timer_settime64			sys_timer_settime
+410	32	timerfd_gettime64		sys_timerfd_gettime
+411	32	timerfd_settime64		sys_timerfd_settime
+412	32	utimensat_time64		sys_utimensat
+413	32	pselect6_time64			sys_pselect6			compat_sys_pselect6_time64
+414	32	ppoll_time64			sys_ppoll			compat_sys_ppoll_time64
+416	32	io_pgetevents_time64		sys_io_pgetevents		compat_sys_io_pgetevents_time64
+417	32	recvmmsg_time64			sys_recvmmsg			compat_sys_recvmmsg_time64
+418	32	mq_timedsend_time64		sys_mq_timedsend
+419	32	mq_timedreceive_time64		sys_mq_timedreceive
+420	32	semtimedop_time64		sys_semtimedop
+421	32	rt_sigtimedwait_time64		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait_time64
+422	32	futex_time64			sys_futex
+423	32	sched_rr_get_interval_time64	sys_sched_rr_get_interval
+424	common	pidfd_send_signal		sys_pidfd_send_signal
+425	common	io_uring_setup			sys_io_uring_setup
+426	common	io_uring_enter			sys_io_uring_enter
+427	common	io_uring_register		sys_io_uring_register
+428	common	open_tree			sys_open_tree
+429	common	move_mount			sys_move_mount
+430	common	fsopen				sys_fsopen
+431	common	fsconfig			sys_fsconfig
+432	common	fsmount				sys_fsmount
+433	common	fspick				sys_fspick
+434	common	pidfd_open			sys_pidfd_open
+435	cln3	clone3				sys_clone3
+435	__cln3	clone3				__sys_clone3
+436	common	close_range			sys_close_range
+437	common	openat2				sys_openat2
+438	common	pidfd_getfd			sys_pidfd_getfd
+439	common	faccessat2			sys_faccessat2
+440	common	process_madvise			sys_process_madvise
+441	common	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
+442	common	mount_setattr			sys_mount_setattr
+443	common	quotactl_fd			sys_quotactl_fd
+444	common	landlock_create_ruleset		sys_landlock_create_ruleset
+445	common	landlock_add_rule		sys_landlock_add_rule
+446	common	landlock_restrict_self		sys_landlock_restrict_self
+447	memfd_secret	memfd_secret		sys_memfd_secret
+448	common	process_mrelease		sys_process_mrelease
+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	fchmodat2			sys_fchmodat2
+453	common	map_shadow_stack		sys_map_shadow_stack
+454	common	futex_wake			sys_futex_wake
+455	common	futex_wait			sys_futex_wait
+456	common	futex_requeue			sys_futex_requeue
+457	common	statmount			sys_statmount
+458	common	listmount			sys_listmount
+459	common	lsm_get_self_attr		sys_lsm_get_self_attr
+460	common	lsm_set_self_attr		sys_lsm_set_self_attr
+461	common	lsm_list_modules		sys_lsm_list_modules
+462	common	mseal				sys_mseal
+463	common	setxattrat			sys_setxattrat
+464	common	getxattrat			sys_getxattrat
+465	common	listxattrat			sys_listxattrat
+466	common	removexattrat			sys_removexattrat
+467	common	open_tree_attr			sys_open_tree_attr
+468	common	file_getattr			sys_file_getattr
+469	common	file_setattr			sys_file_setattr
+470	common	listns				sys_listns
+471	common	rseq_slice_yield		sys_rseq_slice_yield
diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index bad1ab606a0f..e33cba98a5e9 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -16,7 +16,7 @@
 set -e
 
 usage() {
-	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] [--prefix PREFIX] INFILE OUTFILE" >&2
+	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] [--prefix PREFIX] [--common-tbl] INFILE OUTFILE" >&2
 	echo >&2
 	echo >&2 "  INFILE    input syscall table"
 	echo >&2 "  OUTFILE   output header file"
@@ -26,6 +26,7 @@ usage() {
 	echo >&2 "  --emit-nr          Emit the macro of the number of syscalls (__NR_syscalls)"
 	echo >&2 "  --offset OFFSET    The offset of syscall numbers"
 	echo >&2 "  --prefix PREFIX    The prefix to the macro like __NR_<PREFIX><NAME>"
+	echo >&2 "  --common-tbl PATH  Use the common number table"
 	exit 1
 }
 
@@ -34,6 +35,8 @@ abis=
 emit_nr=
 offset=
 prefix=
+common_tbl=
+common_tbl_path=
 
 while [ $# -gt 0 ]
 do
@@ -50,6 +53,10 @@ do
 	--prefix)
 		prefix=$2
 		shift 2;;
+	--common-tbl)
+		common_tbl=1
+		common_tbl_path=$2
+		shift 2;;
 	-*)
 		echo "$1: unknown option" >&2
 		usage;;
@@ -69,13 +76,33 @@ guard=_UAPI_ASM_$(basename "$outfile" |
 	sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
 	-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
 
-grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
+emit_start_guard() {
 	echo "#ifndef $guard"
 	echo "#define $guard"
 	echo
+}
+
+# emit_nr(prefix, nr)
+emit_nr() {
+	local nr=$1
+	local prefix=$2
+	echo
+	echo "#ifdef __KERNEL__"
+	echo "#define __NR_${prefix}syscalls $nr"
+	echo "#endif"
+}
+
+emit_end_guard() {
+	echo
+	echo "#endif /* $guard */"
+}
+
+max=0
+# gen_hdr(infile)
+gen_hdr() {
+	input=$1
 
-	max=0
-	while read nr abi name native compat ; do
+	while read nr abi name native compat; do
 
 		max=$nr
 
@@ -84,15 +111,20 @@ grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
 		fi
 
 		echo "#define __NR_$prefix$name $nr"
-	done
 
-	if [ -n "$emit_nr" ]; then
-		echo
-		echo "#ifdef __KERNEL__"
-		echo "#define __NR_${prefix}syscalls $(($max + 1))"
-		echo "#endif"
-	fi
+	done < <(grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input")
+}
 
-	echo
-	echo "#endif /* $guard */"
-} > "$outfile"
+emit_start_guard > $outfile
+
+gen_hdr $infile >> $outfile
+
+if [ -n "$common_tbl" ]; then
+	gen_hdr $common_tbl_path  >> "$outfile"
+fi
+
+if [ -n "$emit_nr" ]; then
+	emit_nr $(($max + 1)) $prefix >> $outfile
+fi
+
+emit_end_guard >> $outfile
diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
index c4b1f85c2dd6..c0fd6af2d892 100755
--- a/scripts/syscalltbl.sh
+++ b/scripts/syscalltbl.sh
@@ -16,18 +16,23 @@
 set -e
 
 usage() {
-	echo >&2 "usage: $0 [--abis ABIS] INFILE OUTFILE" >&2
+	echo >&2 "usage: $0 [--abis ABIS] [--common-tbl] [--no-compat] INFILE OUTFILE" >&2
 	echo >&2
 	echo >&2 "  INFILE    input syscall table"
 	echo >&2 "  OUTFILE   output header file"
 	echo >&2
 	echo >&2 "options:"
 	echo >&2 "  --abis ABIS        ABI(s) to handle (By default, all lines are handled)"
+	echo >&2 "  --common-tbl PATH  Use the common syscall number table"
+	echo >&2 "  --no-compat        Always generate the native entry"
 	exit 1
 }
 
 # default unless specified by options
 abis=
+common_tbl=
+common_tbl_path=
+no_compat=
 
 while [ $# -gt 0 ]
 do
@@ -35,6 +40,13 @@ do
 	--abis)
 		abis="($(echo "${2%,}" | tr ',' '|'))"
 		shift 2;;
+	--common-tbl)
+		common_tbl=1
+		common_tbl_path=$2
+		shift 2;;
+	--no-compat)
+		no_compat=1
+		shift 1;;
 	-*)
 		echo "$1: unknown option" >&2
 		usage;;
@@ -52,12 +64,14 @@ outfile="$2"
 
 nxt=0
 
-grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
+# gen_tbl(infile)
+gen_tbl() {
+	input=$1
 
 	while read nr abi name native compat noreturn; do
 
 		if [ $nxt -gt $nr ]; then
-			echo "error: $infile: syscall table is not sorted or duplicates the same syscall number" >&2
+			echo "error: $input: syscall table is not sorted or duplicates the same syscall number" >&2
 			exit 1
 		fi
 
@@ -66,13 +80,13 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
 			nxt=$((nxt + 1))
 		done
 
-		if [ "$compat" = "-" ]; then
+		if [ "$compat" = "-" ] || [ -n "$no_compat" ]; then
 			unset compat
 		fi
 
 		if [ -n "$noreturn" ]; then
 			if [ "$noreturn" != "noreturn" ]; then
-				echo "error: $infile: invalid string \"$noreturn\" in 'noreturn' column"
+				echo "error: $input: invalid string \"$noreturn\" in 'noreturn' column"
 				exit 1
 			fi
 			if [ -n "$compat" ]; then
@@ -88,5 +102,13 @@ grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
 			echo "__SYSCALL($nr, sys_ni_syscall)"
 		fi
 		nxt=$((nr + 1))
-	done
-} > "$outfile"
+
+	done < <(grep -E "^[0-9]+[[:space:]]+$abis" "$input")
+
+}
+
+gen_tbl $infile  > "$outfile"
+
+if [ -n "$common_tbl" ]; then
+	gen_tbl $common_tbl_path >> "$outfile"
+fi

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 3/8] scripts/syscall.tbl: Use the common table
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 1/8] syscalls: Make --abis parsing more robust André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 4/8] arm: Use the common syscall table André Almeida
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Remove some of the duplicated code by using the common syscall number
table.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/arm64/tools/syscall_32.tbl | 68 -----------------------------------------
 scripts/Makefile.asm-headers    |  9 +++---
 scripts/syscall.tbl             | 68 -----------------------------------------
 3 files changed, 5 insertions(+), 140 deletions(-)

diff --git a/arch/arm64/tools/syscall_32.tbl b/arch/arm64/tools/syscall_32.tbl
index 62d93d88e0fe..957cb7d59443 100644
--- a/arch/arm64/tools/syscall_32.tbl
+++ b/arch/arm64/tools/syscall_32.tbl
@@ -415,71 +415,3 @@
 400	common	migrate_pages		sys_migrate_pages
 401	common	kexec_file_load		sys_kexec_file_load
 # 402 is unused
-403	common	clock_gettime64			sys_clock_gettime
-404	common	clock_settime64			sys_clock_settime
-405	common	clock_adjtime64			sys_clock_adjtime
-406	common	clock_getres_time64		sys_clock_getres
-407	common	clock_nanosleep_time64		sys_clock_nanosleep
-408	common	timer_gettime64			sys_timer_gettime
-409	common	timer_settime64			sys_timer_settime
-410	common	timerfd_gettime64		sys_timerfd_gettime
-411	common	timerfd_settime64		sys_timerfd_settime
-412	common	utimensat_time64		sys_utimensat
-413	common	pselect6_time64			sys_pselect6			compat_sys_pselect6_time64
-414	common	ppoll_time64			sys_ppoll			compat_sys_ppoll_time64
-416	common	io_pgetevents_time64		sys_io_pgetevents		compat_sys_io_pgetevents_time64
-417	common	recvmmsg_time64			sys_recvmmsg			compat_sys_recvmmsg_time64
-418	common	mq_timedsend_time64		sys_mq_timedsend
-419	common	mq_timedreceive_time64		sys_mq_timedreceive
-420	common	semtimedop_time64		sys_semtimedop
-421	common	rt_sigtimedwait_time64		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait_time64
-422	common	futex_time64			sys_futex
-423	common	sched_rr_get_interval_time64	sys_sched_rr_get_interval
-424	common	pidfd_send_signal		sys_pidfd_send_signal
-425	common	io_uring_setup			sys_io_uring_setup
-426	common	io_uring_enter			sys_io_uring_enter
-427	common	io_uring_register		sys_io_uring_register
-428	common	open_tree			sys_open_tree
-429	common	move_mount			sys_move_mount
-430	common	fsopen				sys_fsopen
-431	common	fsconfig			sys_fsconfig
-432	common	fsmount				sys_fsmount
-433	common	fspick				sys_fspick
-434	common	pidfd_open			sys_pidfd_open
-435	common	clone3				sys_clone3
-436	common	close_range			sys_close_range
-437	common	openat2				sys_openat2
-438	common	pidfd_getfd			sys_pidfd_getfd
-439	common	faccessat2			sys_faccessat2
-440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
-442	common	mount_setattr			sys_mount_setattr
-443	common	quotactl_fd			sys_quotactl_fd
-444	common	landlock_create_ruleset		sys_landlock_create_ruleset
-445	common	landlock_add_rule		sys_landlock_add_rule
-446	common	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	common	process_mrelease		sys_process_mrelease
-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	fchmodat2			sys_fchmodat2
-453	common	map_shadow_stack		sys_map_shadow_stack
-454	common	futex_wake			sys_futex_wake
-455	common	futex_wait			sys_futex_wait
-456	common	futex_requeue			sys_futex_requeue
-457	common	statmount			sys_statmount
-458	common	listmount			sys_listmount
-459	common	lsm_get_self_attr		sys_lsm_get_self_attr
-460	common	lsm_set_self_attr		sys_lsm_set_self_attr
-461	common	lsm_list_modules		sys_lsm_list_modules
-462	common	mseal				sys_mseal
-463	common	setxattrat			sys_setxattrat
-464	common	getxattrat			sys_getxattrat
-465	common	listxattrat			sys_listxattrat
-466	common	removexattrat			sys_removexattrat
-467	common	open_tree_attr			sys_open_tree_attr
-468	common	file_getattr			sys_file_getattr
-469	common	file_setattr			sys_file_setattr
-470	common	listns				sys_listns
-471	common	rseq_slice_yield		sys_rseq_slice_yield
diff --git a/scripts/Makefile.asm-headers b/scripts/Makefile.asm-headers
index 8a4856e74180..b8763a32a770 100644
--- a/scripts/Makefile.asm-headers
+++ b/scripts/Makefile.asm-headers
@@ -15,9 +15,10 @@ all:
 
 src := $(srctree)/$(subst /generated,,$(obj))
 
-syscall_abis_32  += common,32
-syscall_abis_64  += common,64
+syscall_abis_32  += cln3,common,32
+syscall_abis_64  += cln3,common,64
 syscalltbl := $(srctree)/scripts/syscall.tbl
+syscalltbl_common := $(srctree)/scripts/syscall_common.tbl
 syshdr-args := --emit-nr
 
 # let architectures override $(syscall_abis_%) and $(syscalltbl)
@@ -58,14 +59,14 @@ quiet_cmd_remove = REMOVE  $(unwanted)
       cmd_remove = rm -f $(unwanted)
 
 quiet_cmd_syshdr = SYSHDR  $@
-      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) \
+      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --common-tbl $(syscalltbl_common) \
 		   $(if $(syshdr-args-$*),$(syshdr-args-$*),$(syshdr-args)) \
 		   $(if $(syscall_compat),--prefix "compat$*_") \
 		   --abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
 		   $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
-      cmd_systbl = $(CONFIG_SHELL) $(systbl) \
+      cmd_systbl = $(CONFIG_SHELL) $(systbl) --common-tbl $(syscalltbl_common) \
 		   $(if $(systbl-args-$*),$(systbl-args-$*),$(systbl-args)) \
 		   --abis $(subst $(space),$(comma),$(strip $(syscall_abis_$*))) \
 		   $< $@
diff --git a/scripts/syscall.tbl b/scripts/syscall.tbl
index 7a42b32b6577..ee828d03094e 100644
--- a/scripts/syscall.tbl
+++ b/scripts/syscall.tbl
@@ -344,71 +344,3 @@
 293	common	rseq				sys_rseq
 294	common	kexec_file_load			sys_kexec_file_load
 # 295 through 402 are unassigned to sync up with generic numbers don't use
-403	32	clock_gettime64			sys_clock_gettime
-404	32	clock_settime64			sys_clock_settime
-405	32	clock_adjtime64			sys_clock_adjtime
-406	32	clock_getres_time64		sys_clock_getres
-407	32	clock_nanosleep_time64		sys_clock_nanosleep
-408	32	timer_gettime64			sys_timer_gettime
-409	32	timer_settime64			sys_timer_settime
-410	32	timerfd_gettime64		sys_timerfd_gettime
-411	32	timerfd_settime64		sys_timerfd_settime
-412	32	utimensat_time64		sys_utimensat
-413	32	pselect6_time64			sys_pselect6			compat_sys_pselect6_time64
-414	32	ppoll_time64			sys_ppoll			compat_sys_ppoll_time64
-416	32	io_pgetevents_time64		sys_io_pgetevents		compat_sys_io_pgetevents_time64
-417	32	recvmmsg_time64			sys_recvmmsg			compat_sys_recvmmsg_time64
-418	32	mq_timedsend_time64		sys_mq_timedsend
-419	32	mq_timedreceive_time64		sys_mq_timedreceive
-420	32	semtimedop_time64		sys_semtimedop
-421	32	rt_sigtimedwait_time64		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait_time64
-422	32	futex_time64			sys_futex
-423	32	sched_rr_get_interval_time64	sys_sched_rr_get_interval
-424	common	pidfd_send_signal		sys_pidfd_send_signal
-425	common	io_uring_setup			sys_io_uring_setup
-426	common	io_uring_enter			sys_io_uring_enter
-427	common	io_uring_register		sys_io_uring_register
-428	common	open_tree			sys_open_tree
-429	common	move_mount			sys_move_mount
-430	common	fsopen				sys_fsopen
-431	common	fsconfig			sys_fsconfig
-432	common	fsmount				sys_fsmount
-433	common	fspick				sys_fspick
-434	common	pidfd_open			sys_pidfd_open
-435	common	clone3				sys_clone3
-436	common	close_range			sys_close_range
-437	common	openat2				sys_openat2
-438	common	pidfd_getfd			sys_pidfd_getfd
-439	common	faccessat2			sys_faccessat2
-440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
-442	common	mount_setattr			sys_mount_setattr
-443	common	quotactl_fd			sys_quotactl_fd
-444	common	landlock_create_ruleset		sys_landlock_create_ruleset
-445	common	landlock_add_rule		sys_landlock_add_rule
-446	common	landlock_restrict_self		sys_landlock_restrict_self
-447	memfd_secret	memfd_secret		sys_memfd_secret
-448	common	process_mrelease		sys_process_mrelease
-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	fchmodat2			sys_fchmodat2
-453	common	map_shadow_stack		sys_map_shadow_stack
-454	common	futex_wake			sys_futex_wake
-455	common	futex_wait			sys_futex_wait
-456	common	futex_requeue			sys_futex_requeue
-457	common	statmount			sys_statmount
-458	common	listmount			sys_listmount
-459	common	lsm_get_self_attr		sys_lsm_get_self_attr
-460	common	lsm_set_self_attr		sys_lsm_set_self_attr
-461	common	lsm_list_modules		sys_lsm_list_modules
-462	common	mseal				sys_mseal
-463	common	setxattrat			sys_setxattrat
-464	common	getxattrat			sys_getxattrat
-465	common	listxattrat			sys_listxattrat
-466	common	removexattrat			sys_removexattrat
-467	common	open_tree_attr			sys_open_tree_attr
-468	common	file_getattr			sys_file_getattr
-469	common	file_setattr			sys_file_setattr
-470	common	listns				sys_listns
-471	common	rseq_slice_yield		sys_rseq_slice_yield

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 4/8] arm: Use the common syscall table
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (2 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 3/8] scripts/syscall.tbl: Use the common table André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 5/8] s390: " André Almeida
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Remove some of the duplicated code by using the common syscall number
table.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/arm/tools/Makefile    | 10 +++++--
 arch/arm/tools/syscall.tbl | 68 ----------------------------------------------
 2 files changed, 7 insertions(+), 71 deletions(-)

diff --git a/arch/arm/tools/Makefile b/arch/arm/tools/Makefile
index 28b6da8ac5f6..3e44ac0810a3 100644
--- a/arch/arm/tools/Makefile
+++ b/arch/arm/tools/Makefile
@@ -12,6 +12,8 @@ syshdr := $(srctree)/scripts/syscallhdr.sh
 sysnr := $(src)/syscallnr.sh
 systbl := $(srctree)/scripts/syscalltbl.sh
 syscall := $(src)/syscall.tbl
+syscalltbl_common := $(srctree)/scripts/syscall_common.tbl
+abis := common,cln3,32
 
 gen-y := $(gen)/calls-oabi.S
 gen-y += $(gen)/calls-eabi.S
@@ -38,11 +40,13 @@ $(kapi)/mach-types.h: $(src)/gen-mach-types $(src)/mach-types FORCE
 	$(call if_changed,gen_mach)
 
 quiet_cmd_syshdr = SYSHDR  $@
-      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis common,$* \
+      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) \
 		   --offset __NR_SYSCALL_BASE $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
-      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
+      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) $< $@
 
 quiet_cmd_sysnr  = SYSNR   $@
       cmd_sysnr  = $(CONFIG_SHELL) $(sysnr) $< $@
@@ -50,7 +54,7 @@ quiet_cmd_sysnr  = SYSNR   $@
 $(uapi)/unistd-%.h: $(syscall) $(syshdr) FORCE
 	$(call if_changed,syshdr)
 
-$(kapi)/unistd-nr.h: $(syscall) $(sysnr) FORCE
+$(kapi)/unistd-nr.h: $(syscalltbl_common) $(sysnr) FORCE
 	$(call if_changed,sysnr)
 
 $(gen)/calls-%.S: $(syscall) $(systbl) FORCE
diff --git a/arch/arm/tools/syscall.tbl b/arch/arm/tools/syscall.tbl
index 94351e22bfcf..d5bc0e7adf2f 100644
--- a/arch/arm/tools/syscall.tbl
+++ b/arch/arm/tools/syscall.tbl
@@ -418,71 +418,3 @@
 400	common	migrate_pages		sys_migrate_pages
 401	common	kexec_file_load		sys_kexec_file_load
 # 402 is unused
-403	common	clock_gettime64			sys_clock_gettime
-404	common	clock_settime64			sys_clock_settime
-405	common	clock_adjtime64			sys_clock_adjtime
-406	common	clock_getres_time64		sys_clock_getres
-407	common	clock_nanosleep_time64		sys_clock_nanosleep
-408	common	timer_gettime64			sys_timer_gettime
-409	common	timer_settime64			sys_timer_settime
-410	common	timerfd_gettime64		sys_timerfd_gettime
-411	common	timerfd_settime64		sys_timerfd_settime
-412	common	utimensat_time64		sys_utimensat
-413	common	pselect6_time64			sys_pselect6
-414	common	ppoll_time64			sys_ppoll
-416	common	io_pgetevents_time64		sys_io_pgetevents
-417	common	recvmmsg_time64			sys_recvmmsg
-418	common	mq_timedsend_time64		sys_mq_timedsend
-419	common	mq_timedreceive_time64		sys_mq_timedreceive
-420	common	semtimedop_time64		sys_semtimedop
-421	common	rt_sigtimedwait_time64		sys_rt_sigtimedwait
-422	common	futex_time64			sys_futex
-423	common	sched_rr_get_interval_time64	sys_sched_rr_get_interval
-424	common	pidfd_send_signal		sys_pidfd_send_signal
-425	common	io_uring_setup			sys_io_uring_setup
-426	common	io_uring_enter			sys_io_uring_enter
-427	common	io_uring_register		sys_io_uring_register
-428	common	open_tree			sys_open_tree
-429	common	move_mount			sys_move_mount
-430	common	fsopen				sys_fsopen
-431	common	fsconfig			sys_fsconfig
-432	common	fsmount				sys_fsmount
-433	common	fspick				sys_fspick
-434	common	pidfd_open			sys_pidfd_open
-435	common	clone3				sys_clone3
-436	common	close_range			sys_close_range
-437	common	openat2				sys_openat2
-438	common	pidfd_getfd			sys_pidfd_getfd
-439	common	faccessat2			sys_faccessat2
-440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2
-442	common	mount_setattr			sys_mount_setattr
-443	common	quotactl_fd			sys_quotactl_fd
-444	common	landlock_create_ruleset		sys_landlock_create_ruleset
-445	common	landlock_add_rule		sys_landlock_add_rule
-446	common	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	common	process_mrelease		sys_process_mrelease
-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	fchmodat2			sys_fchmodat2
-453	common	map_shadow_stack		sys_map_shadow_stack
-454	common	futex_wake			sys_futex_wake
-455	common	futex_wait			sys_futex_wait
-456	common	futex_requeue			sys_futex_requeue
-457	common	statmount			sys_statmount
-458	common	listmount			sys_listmount
-459	common	lsm_get_self_attr		sys_lsm_get_self_attr
-460	common	lsm_set_self_attr		sys_lsm_set_self_attr
-461	common	lsm_list_modules		sys_lsm_list_modules
-462	common	mseal				sys_mseal
-463	common	setxattrat			sys_setxattrat
-464	common	getxattrat			sys_getxattrat
-465	common	listxattrat			sys_listxattrat
-466	common	removexattrat			sys_removexattrat
-467	common	open_tree_attr			sys_open_tree_attr
-468	common	file_getattr			sys_file_getattr
-469	common	file_setattr			sys_file_setattr
-470	common	listns				sys_listns
-471	common	rseq_slice_yield		sys_rseq_slice_yield

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 5/8] s390: Use the common syscall table
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (3 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 4/8] arm: Use the common syscall table André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 6/8] sparc: " André Almeida
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Remove some of the duplicated code by using the common syscall number
table.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/s390/kernel/syscalls/Makefile    |  8 ++++--
 arch/s390/kernel/syscalls/syscall.tbl | 48 -----------------------------------
 2 files changed, 6 insertions(+), 50 deletions(-)

diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile
index d5fca0ca0890..b06d2c8643f7 100644
--- a/arch/s390/kernel/syscalls/Makefile
+++ b/arch/s390/kernel/syscalls/Makefile
@@ -5,14 +5,18 @@ uapi := arch/$(SRCARCH)/include/generated/uapi/asm
 $(shell mkdir -p $(uapi) $(kapi))
 
 syscall := $(src)/syscall.tbl
+syscalltbl_common := $(srctree)/scripts/syscall_common.tbl
 syshdr := $(srctree)/scripts/syscallhdr.sh
 systbl := $(srctree)/scripts/syscalltbl.sh
+abis := common,cln3,memfd_secret
 
 quiet_cmd_syshdr = SYSHDR  $@
-      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@
+      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
-      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
+      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) --no-compat $< $@
 
 $(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
 	$(call if_changed,syshdr)
diff --git a/arch/s390/kernel/syscalls/syscall.tbl b/arch/s390/kernel/syscalls/syscall.tbl
index 09a7ef04d979..ce6d15260dd1 100644
--- a/arch/s390/kernel/syscalls/syscall.tbl
+++ b/arch/s390/kernel/syscalls/syscall.tbl
@@ -350,51 +350,3 @@
 400	common	msgsnd				sys_msgsnd
 401	common	msgrcv				sys_msgrcv
 402	common	msgctl				sys_msgctl
-424	common	pidfd_send_signal		sys_pidfd_send_signal
-425	common	io_uring_setup			sys_io_uring_setup
-426	common	io_uring_enter			sys_io_uring_enter
-427	common	io_uring_register		sys_io_uring_register
-428	common	open_tree			sys_open_tree
-429	common	move_mount			sys_move_mount
-430	common	fsopen				sys_fsopen
-431	common	fsconfig			sys_fsconfig
-432	common	fsmount				sys_fsmount
-433	common	fspick				sys_fspick
-434	common	pidfd_open			sys_pidfd_open
-435	common	clone3				sys_clone3
-436	common	close_range			sys_close_range
-437	common	openat2				sys_openat2
-438	common	pidfd_getfd			sys_pidfd_getfd
-439	common	faccessat2			sys_faccessat2
-440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2
-442	common	mount_setattr			sys_mount_setattr
-443	common	quotactl_fd			sys_quotactl_fd
-444	common	landlock_create_ruleset		sys_landlock_create_ruleset
-445	common	landlock_add_rule		sys_landlock_add_rule
-446	common	landlock_restrict_self		sys_landlock_restrict_self
-447	common	memfd_secret			sys_memfd_secret
-448	common	process_mrelease		sys_process_mrelease
-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	fchmodat2			sys_fchmodat2
-453	common	map_shadow_stack		sys_map_shadow_stack
-454	common	futex_wake			sys_futex_wake
-455	common	futex_wait			sys_futex_wait
-456	common	futex_requeue			sys_futex_requeue
-457	common	statmount			sys_statmount
-458	common	listmount			sys_listmount
-459	common	lsm_get_self_attr		sys_lsm_get_self_attr
-460	common	lsm_set_self_attr		sys_lsm_set_self_attr
-461	common	lsm_list_modules		sys_lsm_list_modules
-462	common	mseal				sys_mseal
-463	common	setxattrat			sys_setxattrat
-464	common	getxattrat			sys_getxattrat
-465	common	listxattrat			sys_listxattrat
-466	common	removexattrat			sys_removexattrat
-467	common	open_tree_attr			sys_open_tree_attr
-468	common	file_getattr			sys_file_getattr
-469	common	file_setattr			sys_file_setattr
-470	common	listns				sys_listns
-471	common	rseq_slice_yield		sys_rseq_slice_yield

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 6/8] sparc: Use the common syscall table
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (4 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 5/8] s390: " André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 7/8] mips: Remove duplicated syscallnr.sh André Almeida
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Remove some of the duplicated code by using the common syscall number
table.

The generated files are not exactly the same as before, but they have no
functional changes:

 - syscall_table_32.h would generated lines like the following
   __SYSCALL_WITH_COMPAT(422, sys_futex, sys_futex), which is equivalent to
   __SYSCALL(422, sys_futex)

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/sparc/kernel/syscalls/Makefile    |  8 +++-
 arch/sparc/kernel/syscalls/syscall.tbl | 68 ----------------------------------
 2 files changed, 6 insertions(+), 70 deletions(-)

diff --git a/arch/sparc/kernel/syscalls/Makefile b/arch/sparc/kernel/syscalls/Makefile
index 8440c16dfb22..925d7886af74 100644
--- a/arch/sparc/kernel/syscalls/Makefile
+++ b/arch/sparc/kernel/syscalls/Makefile
@@ -5,14 +5,18 @@ uapi := arch/$(SRCARCH)/include/generated/uapi/asm
 $(shell mkdir -p $(uapi) $(kapi))
 
 syscall := $(src)/syscall.tbl
+syscalltbl_common := $(srctree)/scripts/syscall_common.tbl
 syshdr := $(srctree)/scripts/syscallhdr.sh
 systbl := $(srctree)/scripts/syscalltbl.sh
+abis := __cln3,common
 
 quiet_cmd_syshdr = SYSHDR  $@
-      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis common,$* $< $@
+      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
-      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis common,$* $< $@
+      cmd_systbl = $(CONFIG_SHELL) $(systbl) --abis $(abis),$* \
+		   --common-tbl $(syscalltbl_common) $< $@
 
 $(uapi)/unistd_%.h: $(syscall) $(syshdr) FORCE
 	$(call if_changed,syshdr)
diff --git a/arch/sparc/kernel/syscalls/syscall.tbl b/arch/sparc/kernel/syscalls/syscall.tbl
index 7e71bf7fcd14..5f407da6b9da 100644
--- a/arch/sparc/kernel/syscalls/syscall.tbl
+++ b/arch/sparc/kernel/syscalls/syscall.tbl
@@ -449,71 +449,3 @@
 400	common	msgsnd			sys_msgsnd			compat_sys_msgsnd
 401	common	msgrcv			sys_msgrcv			compat_sys_msgrcv
 402	common	msgctl			sys_msgctl			compat_sys_msgctl
-403	32	clock_gettime64			sys_clock_gettime		sys_clock_gettime
-404	32	clock_settime64			sys_clock_settime		sys_clock_settime
-405	32	clock_adjtime64			sys_clock_adjtime		sys_clock_adjtime
-406	32	clock_getres_time64		sys_clock_getres		sys_clock_getres
-407	32	clock_nanosleep_time64		sys_clock_nanosleep		sys_clock_nanosleep
-408	32	timer_gettime64			sys_timer_gettime		sys_timer_gettime
-409	32	timer_settime64			sys_timer_settime		sys_timer_settime
-410	32	timerfd_gettime64		sys_timerfd_gettime		sys_timerfd_gettime
-411	32	timerfd_settime64		sys_timerfd_settime		sys_timerfd_settime
-412	32	utimensat_time64		sys_utimensat			sys_utimensat
-413	32	pselect6_time64			sys_pselect6			compat_sys_pselect6_time64
-414	32	ppoll_time64			sys_ppoll			compat_sys_ppoll_time64
-416	32	io_pgetevents_time64		sys_io_pgetevents		compat_sys_io_pgetevents_time64
-417	32	recvmmsg_time64			sys_recvmmsg			compat_sys_recvmmsg_time64
-418	32	mq_timedsend_time64		sys_mq_timedsend		sys_mq_timedsend
-419	32	mq_timedreceive_time64		sys_mq_timedreceive		sys_mq_timedreceive
-420	32	semtimedop_time64		sys_semtimedop			sys_semtimedop
-421	32	rt_sigtimedwait_time64		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait_time64
-422	32	futex_time64			sys_futex			sys_futex
-423	32	sched_rr_get_interval_time64	sys_sched_rr_get_interval	sys_sched_rr_get_interval
-424	common	pidfd_send_signal		sys_pidfd_send_signal
-425	common	io_uring_setup			sys_io_uring_setup
-426	common	io_uring_enter			sys_io_uring_enter
-427	common	io_uring_register		sys_io_uring_register
-428	common	open_tree			sys_open_tree
-429	common	move_mount			sys_move_mount
-430	common	fsopen				sys_fsopen
-431	common	fsconfig			sys_fsconfig
-432	common	fsmount				sys_fsmount
-433	common	fspick				sys_fspick
-434	common	pidfd_open			sys_pidfd_open
-435	common	clone3				__sys_clone3
-436	common	close_range			sys_close_range
-437	common	openat2			sys_openat2
-438	common	pidfd_getfd			sys_pidfd_getfd
-439	common	faccessat2			sys_faccessat2
-440	common	process_madvise			sys_process_madvise
-441	common	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
-442	common	mount_setattr			sys_mount_setattr
-443	common	quotactl_fd			sys_quotactl_fd
-444	common	landlock_create_ruleset		sys_landlock_create_ruleset
-445	common	landlock_add_rule		sys_landlock_add_rule
-446	common	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	common	process_mrelease		sys_process_mrelease
-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	fchmodat2			sys_fchmodat2
-453	common	map_shadow_stack		sys_map_shadow_stack
-454	common	futex_wake			sys_futex_wake
-455	common	futex_wait			sys_futex_wait
-456	common	futex_requeue			sys_futex_requeue
-457	common	statmount			sys_statmount
-458	common	listmount			sys_listmount
-459	common	lsm_get_self_attr		sys_lsm_get_self_attr
-460	common	lsm_set_self_attr		sys_lsm_set_self_attr
-461	common	lsm_list_modules		sys_lsm_list_modules
-462	common	mseal 				sys_mseal
-463	common	setxattrat			sys_setxattrat
-464	common	getxattrat			sys_getxattrat
-465	common	listxattrat			sys_listxattrat
-466	common	removexattrat			sys_removexattrat
-467	common	open_tree_attr			sys_open_tree_attr
-468	common	file_getattr			sys_file_getattr
-469	common	file_setattr			sys_file_setattr
-470	common	listns				sys_listns
-471	common	rseq_slice_yield		sys_rseq_slice_yield

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 7/8] mips: Remove duplicated syscallnr.sh
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (5 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 6/8] sparc: " André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 19:34 ` [PATCH RFC v3 8/8] mips: Use the common syscall table André Almeida
  2026-08-07 20:43 ` [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs Arnd Bergmann
  8 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

The common scripts/ already have a script for generating the numbers of
syscalls file. Use it and drop the custom script.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/mips/kernel/syscalls/Makefile     |  9 +++++----
 arch/mips/kernel/syscalls/syscallnr.sh | 26 --------------------------
 2 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/arch/mips/kernel/syscalls/Makefile b/arch/mips/kernel/syscalls/Makefile
index 56f6f093bb88..69adc21483ed 100644
--- a/arch/mips/kernel/syscalls/Makefile
+++ b/arch/mips/kernel/syscalls/Makefile
@@ -5,16 +5,17 @@ uapi := arch/$(SRCARCH)/include/generated/uapi/asm
 $(shell mkdir -p $(uapi) $(kapi))
 
 syshdr := $(srctree)/scripts/syscallhdr.sh
-sysnr := $(src)/syscallnr.sh
+sysnr := $(srctree)/scripts/syscallnr.sh
 systbl := $(srctree)/scripts/syscalltbl.sh
 
 quiet_cmd_syshdr = SYSHDR  $@
       cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux $< $@
 
 quiet_cmd_sysnr = SYSNR   $@
-      cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@'		\
-		  '$(sysnr_abis_$(basetarget))'			\
-		  '$(sysnr_pfx_$(basetarget))'
+      cmd_sysnr = $(CONFIG_SHELL) $(sysnr) \
+		  --prefix $(sysnr_pfx_$(basetarget))_Linux_ \
+		  --abis $(sysnr_abis_$(basetarget)) \
+		  $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
       cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
diff --git a/arch/mips/kernel/syscalls/syscallnr.sh b/arch/mips/kernel/syscalls/syscallnr.sh
deleted file mode 100644
index c190bbefbfc2..000000000000
--- a/arch/mips/kernel/syscalls/syscallnr.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-
-in="$1"
-out="$2"
-my_abis=`echo "($3)" | tr ',' '|'`
-prefix="$4"
-
-fileguard=_UAPI_ASM_MIPS_`basename "$out" | sed \
-	-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-	-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
-grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
-	printf "#ifndef %s\n" "${fileguard}"
-	printf "#define %s\n" "${fileguard}"
-	printf "\n"
-
-	nxt=0
-	while read nr abi name entry compat ; do
-		nxt=$((nr+1))
-	done
-
-	printf "#define __NR_%s_Linux_syscalls\t%s\n" "${prefix}" "${nxt}"
-	printf "\n"
-	printf "#endif /* %s */" "${fileguard}"
-	printf "\n"
-) > "$out"

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH RFC v3 8/8] mips: Use the common syscall table
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (6 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 7/8] mips: Remove duplicated syscallnr.sh André Almeida
@ 2026-08-07 19:34 ` André Almeida
  2026-08-07 21:02   ` Arnd Bergmann
  2026-08-07 20:43 ` [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs Arnd Bergmann
  8 siblings, 1 reply; 17+ messages in thread
From: André Almeida @ 2026-08-07 19:34 UTC (permalink / raw)
  To: Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu, Arnd Bergmanon
  Cc: linux-kernel, linux-kbuild, kernel-dev, André Almeida

Syscall numbers from 403 are shared with all architectures, so move the
toolchain to use the common syscall table and remove duplicated code.

The generated files are not exactly the same as before, but they have no
functional changes:

 - for O32 ABI, the syscall table would have entries like
 __SYSCALL_WITH_COMPAT(403, sys_clock_gettime, sys_clock_gettime)
 which is equivalent to the new entry __SYSCALL(403, sys_clock_gettime)

 - for N32 ABI, the syscall table would have entries like
 __SYSCALL(413, compat_sys_pselect6_time64), which is equivalent to
 __SYSCALL_WITH_COMPAT(413, sys_pselect6, compat_sys_pselect6_time64)
 given the new __SYSCALL_WITH_COMPAT() definition for N32.

The generated syscall table for N64 is exactly the same.

Signed-off-by: André Almeida <andrealmeid@igalia.com>
---
 arch/mips/kernel/scall64-n32.S            |  1 +
 arch/mips/kernel/syscalls/Makefile        | 22 +++++++---
 arch/mips/kernel/syscalls/syscall_n32.tbl | 68 -------------------------------
 arch/mips/kernel/syscalls/syscall_n64.tbl | 48 ----------------------
 arch/mips/kernel/syscalls/syscall_o32.tbl | 68 -------------------------------
 5 files changed, 18 insertions(+), 189 deletions(-)

diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 97788859238c..ddf81e379464 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -102,6 +102,7 @@ not_n32_scall:
 
 	END(handle_sysn32)
 
+#define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat)
 #define __SYSCALL(nr, entry)	PTR_WD entry
 	.type	sysn32_call_table, @object
 EXPORT(sysn32_call_table)
diff --git a/arch/mips/kernel/syscalls/Makefile b/arch/mips/kernel/syscalls/Makefile
index 69adc21483ed..9748d053d665 100644
--- a/arch/mips/kernel/syscalls/Makefile
+++ b/arch/mips/kernel/syscalls/Makefile
@@ -7,18 +7,22 @@ $(shell mkdir -p $(uapi) $(kapi))
 syshdr := $(srctree)/scripts/syscallhdr.sh
 sysnr := $(srctree)/scripts/syscallnr.sh
 systbl := $(srctree)/scripts/syscalltbl.sh
+systbl_common := $(srctree)/scripts/syscall_common.tbl
 
 quiet_cmd_syshdr = SYSHDR  $@
-      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux $< $@
+      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --offset __NR_Linux \
+		   --common-tbl $(systbl_common) \
+		   --abis $(abis_$*) $< $@
 
 quiet_cmd_sysnr = SYSNR   $@
       cmd_sysnr = $(CONFIG_SHELL) $(sysnr) \
 		  --prefix $(sysnr_pfx_$(basetarget))_Linux_ \
-		  --abis $(sysnr_abis_$(basetarget)) \
-		  $< $@
+		   --abis $(abis_$*) $< $@
 
 quiet_cmd_systbl = SYSTBL  $@
-      cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
+      cmd_systbl = $(CONFIG_SHELL) $(systbl) \
+		   --common-tbl $(systbl_common) \
+		   --abis $(abis_$*) $(no_compat_$*) $< $@
 
 $(uapi)/unistd_%.h: $(src)/syscall_%.tbl $(syshdr) FORCE
 	$(call if_changed,syshdr)
@@ -27,7 +31,15 @@ sysnr_pfx_unistd_nr_n32 := N32
 sysnr_pfx_unistd_nr_n64 := 64
 sysnr_pfx_unistd_nr_o32 := O32
 
-$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
+abis := common,__cln3
+
+abis_n32 := $(abis),32,n32
+abis_o32 := $(abis),32,o32
+abis_n64 := $(abis),64,n64
+
+no_compat_n64 := --no-compat
+
+$(kapi)/unistd_nr_%.h: $(systbl_common) $(sysnr) FORCE
 	$(call if_changed,sysnr)
 
 $(kapi)/syscall_table_%.h: $(src)/syscall_%.tbl $(systbl) FORCE
diff --git a/arch/mips/kernel/syscalls/syscall_n32.tbl b/arch/mips/kernel/syscalls/syscall_n32.tbl
index 7430714e2b8f..b3ba69c3c9c3 100644
--- a/arch/mips/kernel/syscalls/syscall_n32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n32.tbl
@@ -342,71 +342,3 @@
 331	n32	rseq				sys_rseq
 332	n32	io_pgetevents			compat_sys_io_pgetevents
 # 333 through 402 are unassigned to sync up with generic numbers
-403	n32	clock_gettime64			sys_clock_gettime
-404	n32	clock_settime64			sys_clock_settime
-405	n32	clock_adjtime64			sys_clock_adjtime
-406	n32	clock_getres_time64		sys_clock_getres
-407	n32	clock_nanosleep_time64		sys_clock_nanosleep
-408	n32	timer_gettime64			sys_timer_gettime
-409	n32	timer_settime64			sys_timer_settime
-410	n32	timerfd_gettime64		sys_timerfd_gettime
-411	n32	timerfd_settime64		sys_timerfd_settime
-412	n32	utimensat_time64		sys_utimensat
-413	n32	pselect6_time64			compat_sys_pselect6_time64
-414	n32	ppoll_time64			compat_sys_ppoll_time64
-416	n32	io_pgetevents_time64		compat_sys_io_pgetevents_time64
-417	n32	recvmmsg_time64			compat_sys_recvmmsg_time64
-418	n32	mq_timedsend_time64		sys_mq_timedsend
-419	n32	mq_timedreceive_time64		sys_mq_timedreceive
-420	n32	semtimedop_time64		sys_semtimedop
-421	n32	rt_sigtimedwait_time64		compat_sys_rt_sigtimedwait_time64
-422	n32	futex_time64			sys_futex
-423	n32	sched_rr_get_interval_time64	sys_sched_rr_get_interval
-424	n32	pidfd_send_signal		sys_pidfd_send_signal
-425	n32	io_uring_setup			sys_io_uring_setup
-426	n32	io_uring_enter			sys_io_uring_enter
-427	n32	io_uring_register		sys_io_uring_register
-428	n32	open_tree			sys_open_tree
-429	n32	move_mount			sys_move_mount
-430	n32	fsopen				sys_fsopen
-431	n32	fsconfig			sys_fsconfig
-432	n32	fsmount				sys_fsmount
-433	n32	fspick				sys_fspick
-434	n32	pidfd_open			sys_pidfd_open
-435	n32	clone3				__sys_clone3
-436	n32	close_range			sys_close_range
-437	n32	openat2				sys_openat2
-438	n32	pidfd_getfd			sys_pidfd_getfd
-439	n32	faccessat2			sys_faccessat2
-440	n32	process_madvise			sys_process_madvise
-441	n32	epoll_pwait2			compat_sys_epoll_pwait2
-442	n32	mount_setattr			sys_mount_setattr
-443	n32	quotactl_fd			sys_quotactl_fd
-444	n32	landlock_create_ruleset		sys_landlock_create_ruleset
-445	n32	landlock_add_rule		sys_landlock_add_rule
-446	n32	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	n32	process_mrelease		sys_process_mrelease
-449	n32	futex_waitv			sys_futex_waitv
-450	n32	set_mempolicy_home_node		sys_set_mempolicy_home_node
-451	n32	cachestat			sys_cachestat
-452	n32	fchmodat2			sys_fchmodat2
-453	n32	map_shadow_stack		sys_map_shadow_stack
-454	n32	futex_wake			sys_futex_wake
-455	n32	futex_wait			sys_futex_wait
-456	n32	futex_requeue			sys_futex_requeue
-457	n32	statmount			sys_statmount
-458	n32	listmount			sys_listmount
-459	n32	lsm_get_self_attr		sys_lsm_get_self_attr
-460	n32	lsm_set_self_attr		sys_lsm_set_self_attr
-461	n32	lsm_list_modules		sys_lsm_list_modules
-462	n32	mseal				sys_mseal
-463	n32	setxattrat			sys_setxattrat
-464	n32	getxattrat			sys_getxattrat
-465	n32	listxattrat			sys_listxattrat
-466	n32	removexattrat			sys_removexattrat
-467	n32	open_tree_attr			sys_open_tree_attr
-468	n32	file_getattr			sys_file_getattr
-469	n32	file_setattr			sys_file_setattr
-470	n32	listns				sys_listns
-471	n32	rseq_slice_yield		sys_rseq_slice_yield
diff --git a/arch/mips/kernel/syscalls/syscall_n64.tbl b/arch/mips/kernel/syscalls/syscall_n64.tbl
index 630aab9e5425..36c537c0d9f3 100644
--- a/arch/mips/kernel/syscalls/syscall_n64.tbl
+++ b/arch/mips/kernel/syscalls/syscall_n64.tbl
@@ -338,51 +338,3 @@
 327	n64	rseq				sys_rseq
 328	n64	io_pgetevents			sys_io_pgetevents
 # 329 through 423 are reserved to sync up with other architectures
-424	n64	pidfd_send_signal		sys_pidfd_send_signal
-425	n64	io_uring_setup			sys_io_uring_setup
-426	n64	io_uring_enter			sys_io_uring_enter
-427	n64	io_uring_register		sys_io_uring_register
-428	n64	open_tree			sys_open_tree
-429	n64	move_mount			sys_move_mount
-430	n64	fsopen				sys_fsopen
-431	n64	fsconfig			sys_fsconfig
-432	n64	fsmount				sys_fsmount
-433	n64	fspick				sys_fspick
-434	n64	pidfd_open			sys_pidfd_open
-435	n64	clone3				__sys_clone3
-436	n64	close_range			sys_close_range
-437	n64	openat2				sys_openat2
-438	n64	pidfd_getfd			sys_pidfd_getfd
-439	n64	faccessat2			sys_faccessat2
-440	n64	process_madvise			sys_process_madvise
-441	n64	epoll_pwait2			sys_epoll_pwait2
-442	n64	mount_setattr			sys_mount_setattr
-443	n64	quotactl_fd			sys_quotactl_fd
-444	n64	landlock_create_ruleset		sys_landlock_create_ruleset
-445	n64	landlock_add_rule		sys_landlock_add_rule
-446	n64	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	n64	process_mrelease		sys_process_mrelease
-449	n64	futex_waitv			sys_futex_waitv
-450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
-451	n64	cachestat			sys_cachestat
-452	n64	fchmodat2			sys_fchmodat2
-453	n64	map_shadow_stack		sys_map_shadow_stack
-454	n64	futex_wake			sys_futex_wake
-455	n64	futex_wait			sys_futex_wait
-456	n64	futex_requeue			sys_futex_requeue
-457	n64	statmount			sys_statmount
-458	n64	listmount			sys_listmount
-459	n64	lsm_get_self_attr		sys_lsm_get_self_attr
-460	n64	lsm_set_self_attr		sys_lsm_set_self_attr
-461	n64	lsm_list_modules		sys_lsm_list_modules
-462	n64	mseal				sys_mseal
-463	n64	setxattrat			sys_setxattrat
-464	n64	getxattrat			sys_getxattrat
-465	n64	listxattrat			sys_listxattrat
-466	n64	removexattrat			sys_removexattrat
-467	n64	open_tree_attr			sys_open_tree_attr
-468	n64	file_getattr			sys_file_getattr
-469	n64	file_setattr			sys_file_setattr
-470	n64	listns				sys_listns
-471	n64	rseq_slice_yield		sys_rseq_slice_yield
diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 128653112284..070d7f7dd1aa 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -391,71 +391,3 @@
 400	o32	msgsnd				sys_msgsnd			compat_sys_msgsnd
 401	o32	msgrcv				sys_msgrcv			compat_sys_msgrcv
 402	o32	msgctl				sys_msgctl			compat_sys_msgctl
-403	o32	clock_gettime64			sys_clock_gettime		sys_clock_gettime
-404	o32	clock_settime64			sys_clock_settime		sys_clock_settime
-405	o32	clock_adjtime64			sys_clock_adjtime		sys_clock_adjtime
-406	o32	clock_getres_time64		sys_clock_getres		sys_clock_getres
-407	o32	clock_nanosleep_time64		sys_clock_nanosleep		sys_clock_nanosleep
-408	o32	timer_gettime64			sys_timer_gettime		sys_timer_gettime
-409	o32	timer_settime64			sys_timer_settime		sys_timer_settime
-410	o32	timerfd_gettime64		sys_timerfd_gettime		sys_timerfd_gettime
-411	o32	timerfd_settime64		sys_timerfd_settime		sys_timerfd_settime
-412	o32	utimensat_time64		sys_utimensat			sys_utimensat
-413	o32	pselect6_time64			sys_pselect6			compat_sys_pselect6_time64
-414	o32	ppoll_time64			sys_ppoll			compat_sys_ppoll_time64
-416	o32	io_pgetevents_time64		sys_io_pgetevents		compat_sys_io_pgetevents_time64
-417	o32	recvmmsg_time64			sys_recvmmsg			compat_sys_recvmmsg_time64
-418	o32	mq_timedsend_time64		sys_mq_timedsend		sys_mq_timedsend
-419	o32	mq_timedreceive_time64		sys_mq_timedreceive		sys_mq_timedreceive
-420	o32	semtimedop_time64		sys_semtimedop			sys_semtimedop
-421	o32	rt_sigtimedwait_time64		sys_rt_sigtimedwait		compat_sys_rt_sigtimedwait_time64
-422	o32	futex_time64			sys_futex			sys_futex
-423	o32	sched_rr_get_interval_time64	sys_sched_rr_get_interval	sys_sched_rr_get_interval
-424	o32	pidfd_send_signal		sys_pidfd_send_signal
-425	o32	io_uring_setup			sys_io_uring_setup
-426	o32	io_uring_enter			sys_io_uring_enter
-427	o32	io_uring_register		sys_io_uring_register
-428	o32	open_tree			sys_open_tree
-429	o32	move_mount			sys_move_mount
-430	o32	fsopen				sys_fsopen
-431	o32	fsconfig			sys_fsconfig
-432	o32	fsmount				sys_fsmount
-433	o32	fspick				sys_fspick
-434	o32	pidfd_open			sys_pidfd_open
-435	o32	clone3				__sys_clone3
-436	o32	close_range			sys_close_range
-437	o32	openat2				sys_openat2
-438	o32	pidfd_getfd			sys_pidfd_getfd
-439	o32	faccessat2			sys_faccessat2
-440	o32	process_madvise			sys_process_madvise
-441	o32	epoll_pwait2			sys_epoll_pwait2		compat_sys_epoll_pwait2
-442	o32	mount_setattr			sys_mount_setattr
-443	o32	quotactl_fd			sys_quotactl_fd
-444	o32	landlock_create_ruleset		sys_landlock_create_ruleset
-445	o32	landlock_add_rule		sys_landlock_add_rule
-446	o32	landlock_restrict_self		sys_landlock_restrict_self
-# 447 reserved for memfd_secret
-448	o32	process_mrelease		sys_process_mrelease
-449	o32	futex_waitv			sys_futex_waitv
-450	o32	set_mempolicy_home_node		sys_set_mempolicy_home_node
-451	o32	cachestat			sys_cachestat
-452	o32	fchmodat2			sys_fchmodat2
-453	o32	map_shadow_stack		sys_map_shadow_stack
-454	o32	futex_wake			sys_futex_wake
-455	o32	futex_wait			sys_futex_wait
-456	o32	futex_requeue			sys_futex_requeue
-457	o32	statmount			sys_statmount
-458	o32	listmount			sys_listmount
-459	o32	lsm_get_self_attr		sys_lsm_get_self_attr
-460	o32	lsm_set_self_attr		sys_lsm_set_self_attr
-461	o32	lsm_list_modules		sys_lsm_list_modules
-462	o32	mseal				sys_mseal
-463	o32	setxattrat			sys_setxattrat
-464	o32	getxattrat			sys_getxattrat
-465	o32	listxattrat			sys_listxattrat
-466	o32	removexattrat			sys_removexattrat
-467	o32	open_tree_attr			sys_open_tree_attr
-468	o32	file_getattr			sys_file_getattr
-469	o32	file_setattr			sys_file_setattr
-470	o32	listns				sys_listns
-471	o32	rseq_slice_yield		sys_rseq_slice_yield

-- 
2.55.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs
  2026-08-07 19:34 ` [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs André Almeida
@ 2026-08-07 20:40   ` Arnd Bergmann
  2026-08-10 13:19     ` André Almeida
  0 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2026-08-07 20:40 UTC (permalink / raw)
  To: André Almeida, Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu
  Cc: linux-kernel, linux-kbuild, kernel-dev

On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
> To take advantage of the subset of syscall numbers that are guaranteed to
> be shared, create a new table and adapt generation scripts to use it. In
> that way, every new syscall can be added to a single file.
>
> Create special ABIs in order to make the table work for different archs:
>
>  - `memfd_secret` for archs that implements it

This was already there, so it's not really a new addition. We could
also avoid this entirely and just rely on the stub implementation
from kernel/sys_ni.c for those architectures that don't need it.
They still get the macro definition, but it should be fine to define
that for everyone.

>  - `cln3` for archs that use the common clone3 entry
>  - `__cln3` for archs that use their own special entry point

I guess that's one way to do it. I would probably use the full
clone3/__clone3 name here for consistency.

> Some archs only care about the native entry point and have no compat, so
> create a option to never generate __SYSCALL_WITH_COMPAT() and always
> generate __SYSCALL().

I don't see the purpose of this and would prefer to not add that
extra option if the scripts works fine without it.

>  usage() {
> -	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] 
> [--prefix PREFIX] INFILE OUTFILE" >&2
> +	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET] 
> [--prefix PREFIX] [--common-tbl] INFILE OUTFILE" >&2

This needs to be changed to include the argument of common-tbl

> diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
> index c4b1f85c2dd6..c0fd6af2d892 100755
> --- a/scripts/syscalltbl.sh
> +++ b/scripts/syscalltbl.sh
> @@ -16,18 +16,23 @@
>  set -e
> 
>  usage() {
> -	echo >&2 "usage: $0 [--abis ABIS] INFILE OUTFILE" >&2
> +	echo >&2 "usage: $0 [--abis ABIS] [--common-tbl] [--no-compat] INFILE 

same here

     Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs
  2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
                   ` (7 preceding siblings ...)
  2026-08-07 19:34 ` [PATCH RFC v3 8/8] mips: Use the common syscall table André Almeida
@ 2026-08-07 20:43 ` Arnd Bergmann
  2026-08-10 13:25   ` André Almeida
  8 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2026-08-07 20:43 UTC (permalink / raw)
  To: André Almeida, Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu
  Cc: linux-kernel, linux-kbuild, kernel-dev

On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
>
> There's already a "common" table shared with a bunch of archs at
> `scripts/syscall.tbl`, but due to historical reasons some archs will never be
> able to move to this table and share all the numbers.
>
> The generic table starts from 403 (clock_gettime64), the first common syscall.
>
> I've compile tested for arm32, arm64, s390, mips and sparc, by comparing the
> syscalls_*.h and unistd_*.h files generated before and after this patchset. For
> most of cases the files are identical, for the few cases that they are not,
> there's a note in the commit explaining why they are equivalent.

Any reason you still didn't include the alpha version? As I mentioned
before, I think this is the most important one to be in the initial
set, to ensure the script can deal with the having two separate offsets
without becoming too messy, or needing a rewrite to take multiple passes.

      Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 8/8] mips: Use the common syscall table
  2026-08-07 19:34 ` [PATCH RFC v3 8/8] mips: Use the common syscall table André Almeida
@ 2026-08-07 21:02   ` Arnd Bergmann
  2026-08-10 13:20     ` André Almeida
  0 siblings, 1 reply; 17+ messages in thread
From: Arnd Bergmann @ 2026-08-07 21:02 UTC (permalink / raw)
  To: André Almeida, Thomas Gleixner, Nathan Chancellor, Masami Hiramatsu
  Cc: linux-kernel, linux-kbuild, kernel-dev

On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
> Syscall numbers from 403 are shared with all architectures, so move the
> toolchain to use the common syscall table and remove duplicated code.
>
> The generated files are not exactly the same as before, but they have no
> functional changes:
>
>  - for O32 ABI, the syscall table would have entries like
>  __SYSCALL_WITH_COMPAT(403, sys_clock_gettime, sys_clock_gettime)
>  which is equivalent to the new entry __SYSCALL(403, sys_clock_gettime)
>
>  - for N32 ABI, the syscall table would have entries like
>  __SYSCALL(413, compat_sys_pselect6_time64), which is equivalent to
>  __SYSCALL_WITH_COMPAT(413, sys_pselect6, compat_sys_pselect6_time64)
>  given the new __SYSCALL_WITH_COMPAT() definition for N32.
>
> The generated syscall table for N64 is exactly the same.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
>  arch/mips/kernel/scall64-n32.S            |  1 +
>  arch/mips/kernel/syscalls/Makefile        | 22 +++++++---
>  arch/mips/kernel/syscalls/syscall_n32.tbl | 68 -------------------------------
>  arch/mips/kernel/syscalls/syscall_n64.tbl | 48 ----------------------
>  arch/mips/kernel/syscalls/syscall_o32.tbl | 68 -------------------------------
>  5 files changed, 18 insertions(+), 189 deletions(-)

I still wonder whether we should combine the n32 and n64 tables
here. Since the script can now deal with multiple input files,
the first 211 syscall numbers can be in a shared file, while
numbers 212 through 332 are always going to be different.

Alternatively, two the files could just be merged into one file
like

0       common    read                       sys_read
1       common    write                      sys_write
...
13      common    rt_sigaction                sys_rt_sigaction     compat_sys_rt_sigaction
...
210     common    remap_file_pages           sys_remap_file_pages
211     common    rt_sigreturn               sys_rt_sigreturn
...
212     32        fcntl64                       compat_sys_fcntl64
213     32        set_tid_address               sys_set_tid_address
...
212     64        set_tid_address               sys_set_tid_address
213     64        restart_syscall               sys_restart_syscall

 
> -$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
> +abis := common,__cln3
> +
> +abis_n32 := $(abis),32,n32
> +abis_o32 := $(abis),32,o32
> +abis_n64 := $(abis),64,n64

We should probably drop the custom ABI names here and just use
common/32/64 in the .tbl file. There was never a real need for
the special case here, and now it causes extra complexity.

     Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs
  2026-08-07 20:40   ` Arnd Bergmann
@ 2026-08-10 13:19     ` André Almeida
  2026-08-10 14:22       ` Arnd Bergmann
  0 siblings, 1 reply; 17+ messages in thread
From: André Almeida @ 2026-08-10 13:19 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, Masami Hiramatsu, Nathan Chancellor,
	Thomas Gleixner, linux-kbuild, kernel-dev

Em 07/08/2026 17:40, Arnd Bergmann escreveu:
> On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
>> To take advantage of the subset of syscall numbers that are guaranteed to
>> be shared, create a new table and adapt generation scripts to use it. In
>> that way, every new syscall can be added to a single file.
>>
>> Create special ABIs in order to make the table work for different archs:
>>
>>   - `memfd_secret` for archs that implements it
> 
> This was already there, so it's not really a new addition. We could
> also avoid this entirely and just rely on the stub implementation
> from kernel/sys_ni.c for those architectures that don't need it.
> They still get the macro definition, but it should be fine to define
> that for everyone.
> 
>>   - `cln3` for archs that use the common clone3 entry
>>   - `__cln3` for archs that use their own special entry point
> 
> I guess that's one way to do it. I would probably use the full
> clone3/__clone3 name here for consistency.
> 
>> Some archs only care about the native entry point and have no compat, so
>> create a option to never generate __SYSCALL_WITH_COMPAT() and always
>> generate __SYSCALL().
> 
> I don't see the purpose of this and would prefer to not add that
> extra option if the scripts works fine without it.
> 

Some archs don't define __SYSCALL_WITH_COMPAT() (see x86_64 for 
instance), so that's why I have added this option. But I can define 
__SYSCALL_WITH_COMPAT() as SYSCALL(nr, native) for those archs.

>>   usage() {
>> -	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET]
>> [--prefix PREFIX] INFILE OUTFILE" >&2
>> +	echo >&2 "usage: $0 [--abis ABIS] [--emit-nr] [--offset OFFSET]
>> [--prefix PREFIX] [--common-tbl] INFILE OUTFILE" >&2
> 
> This needs to be changed to include the argument of common-tbl
> 
>> diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
>> index c4b1f85c2dd6..c0fd6af2d892 100755
>> --- a/scripts/syscalltbl.sh
>> +++ b/scripts/syscalltbl.sh
>> @@ -16,18 +16,23 @@
>>   set -e
>>
>>   usage() {
>> -	echo >&2 "usage: $0 [--abis ABIS] INFILE OUTFILE" >&2
>> +	echo >&2 "usage: $0 [--abis ABIS] [--common-tbl] [--no-compat] INFILE
> 
> same here
> 
>       Arnd


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 8/8] mips: Use the common syscall table
  2026-08-07 21:02   ` Arnd Bergmann
@ 2026-08-10 13:20     ` André Almeida
  0 siblings, 0 replies; 17+ messages in thread
From: André Almeida @ 2026-08-10 13:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, Nathan Chancellor, Thomas Gleixner, linux-kbuild,
	Masami Hiramatsu, kernel-dev

Em 07/08/2026 18:02, Arnd Bergmann escreveu:
> On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
>> Syscall numbers from 403 are shared with all architectures, so move the
>> toolchain to use the common syscall table and remove duplicated code.
>>
>> The generated files are not exactly the same as before, but they have no
>> functional changes:
>>
>>   - for O32 ABI, the syscall table would have entries like
>>   __SYSCALL_WITH_COMPAT(403, sys_clock_gettime, sys_clock_gettime)
>>   which is equivalent to the new entry __SYSCALL(403, sys_clock_gettime)
>>
>>   - for N32 ABI, the syscall table would have entries like
>>   __SYSCALL(413, compat_sys_pselect6_time64), which is equivalent to
>>   __SYSCALL_WITH_COMPAT(413, sys_pselect6, compat_sys_pselect6_time64)
>>   given the new __SYSCALL_WITH_COMPAT() definition for N32.
>>
>> The generated syscall table for N64 is exactly the same.
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>> ---
>>   arch/mips/kernel/scall64-n32.S            |  1 +
>>   arch/mips/kernel/syscalls/Makefile        | 22 +++++++---
>>   arch/mips/kernel/syscalls/syscall_n32.tbl | 68 -------------------------------
>>   arch/mips/kernel/syscalls/syscall_n64.tbl | 48 ----------------------
>>   arch/mips/kernel/syscalls/syscall_o32.tbl | 68 -------------------------------
>>   5 files changed, 18 insertions(+), 189 deletions(-)
> 
> I still wonder whether we should combine the n32 and n64 tables
> here. Since the script can now deal with multiple input files,
> the first 211 syscall numbers can be in a shared file, while
> numbers 212 through 332 are always going to be different.
> 
> Alternatively, two the files could just be merged into one file
> like
> 
> 0       common    read                       sys_read
> 1       common    write                      sys_write
> ...
> 13      common    rt_sigaction                sys_rt_sigaction     compat_sys_rt_sigaction
> ...
> 210     common    remap_file_pages           sys_remap_file_pages
> 211     common    rt_sigreturn               sys_rt_sigreturn
> ...
> 212     32        fcntl64                       compat_sys_fcntl64
> 213     32        set_tid_address               sys_set_tid_address
> ...
> 212     64        set_tid_address               sys_set_tid_address
> 213     64        restart_syscall               sys_restart_syscall
> 
>   
>> -$(kapi)/unistd_nr_%.h: $(src)/syscall_%.tbl $(sysnr) FORCE
>> +abis := common,__cln3
>> +
>> +abis_n32 := $(abis),32,n32
>> +abis_o32 := $(abis),32,o32
>> +abis_n64 := $(abis),64,n64
> 
> We should probably drop the custom ABI names here and just use
> common/32/64 in the .tbl file. There was never a real need for
> the special case here, and now it causes extra complexity.
> 
Ok! I like this ideas, I will prepare it for v4

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs
  2026-08-07 20:43 ` [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs Arnd Bergmann
@ 2026-08-10 13:25   ` André Almeida
  2026-08-10 14:18     ` Arnd Bergmann
  0 siblings, 1 reply; 17+ messages in thread
From: André Almeida @ 2026-08-10 13:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-kernel, Masami Hiramatsu, Nathan Chancellor,
	Thomas Gleixner, linux-kbuild, kernel-dev

Em 07/08/2026 17:43, Arnd Bergmann escreveu:
> On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
>>
>> There's already a "common" table shared with a bunch of archs at
>> `scripts/syscall.tbl`, but due to historical reasons some archs will never be
>> able to move to this table and share all the numbers.
>>
>> The generic table starts from 403 (clock_gettime64), the first common syscall.
>>
>> I've compile tested for arm32, arm64, s390, mips and sparc, by comparing the
>> syscalls_*.h and unistd_*.h files generated before and after this patchset. For
>> most of cases the files are identical, for the few cases that they are not,
>> there's a note in the commit explaining why they are equivalent.
> 
> Any reason you still didn't include the alpha version? As I mentioned
> before, I think this is the most important one to be in the initial
> set, to ensure the script can deal with the having two separate offsets
> without becoming too messy, or needing a rewrite to take multiple passes.
> 
>        Arnd


One reason that I didn't include alpha on this version yet (but forgot 
to explain in the cover letter) is that alpha is the only arch that 
doesn't implement `set_mempolicy_home_node`, and the commit message that 
creates this syscall doesn't help to explain why. But for now I think I 
can do something similar to `memfd_secret` and add a new ABI or use the 
stub implementation.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs
  2026-08-10 13:25   ` André Almeida
@ 2026-08-10 14:18     ` Arnd Bergmann
  0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2026-08-10 14:18 UTC (permalink / raw)
  To: André Almeida
  Cc: linux-kernel, Masami Hiramatsu, Nathan Chancellor,
	Thomas Gleixner, linux-kbuild, kernel-dev

On Mon, Aug 10, 2026, at 15:25, André Almeida wrote:
> Em 07/08/2026 17:43, Arnd Bergmann escreveu:
>> On Fri, Aug 7, 2026, at 21:34, André Almeida wrote:
>>>
>>> There's already a "common" table shared with a bunch of archs at
>>> `scripts/syscall.tbl`, but due to historical reasons some archs will never be
>>> able to move to this table and share all the numbers.
>>>
>>> The generic table starts from 403 (clock_gettime64), the first common syscall.
>>>
>>> I've compile tested for arm32, arm64, s390, mips and sparc, by comparing the
>>> syscalls_*.h and unistd_*.h files generated before and after this patchset. For
>>> most of cases the files are identical, for the few cases that they are not,
>>> there's a note in the commit explaining why they are equivalent.
>> 
>> Any reason you still didn't include the alpha version? As I mentioned
>> before, I think this is the most important one to be in the initial
>> set, to ensure the script can deal with the having two separate offsets
>> without becoming too messy, or needing a rewrite to take multiple passes.
>
> One reason that I didn't include alpha on this version yet (but forgot 
> to explain in the cover letter) is that alpha is the only arch that 
> doesn't implement `set_mempolicy_home_node`, and the commit message that 
> creates this syscall doesn't help to explain why. But for now I think I 
> can do something similar to `memfd_secret` and add a new ABI or use the 
> stub implementation.

No, I think we can just keep the normal table here. There is
already a definition for the syscall macro on alpha, just the
entry point is set to sys_ni_syscall. On alpha, CONFIG_NUMA
is always disabled as of fdb7d9b7acd0 ("alpha: remove DISCONTIGMEM
and NUMA"), so sys_mempolicy_home_node always points to
sys_ni_syscall through the kernel/sys_ni.c redirect.

I would split that change out to a separate commit, but that
patch is clearly only cosmetic here.

We probably want the same thing for memfd_secret() as well, and
always define that for all architectures, with the kernel/sys_ni.c
file taking care of the CONFIG_SECRETMEM=n builds, but that is
not entirely a nop, since it adds a __NR_memfd_seret macro
on architectures that don't already have it.

       Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs
  2026-08-10 13:19     ` André Almeida
@ 2026-08-10 14:22       ` Arnd Bergmann
  0 siblings, 0 replies; 17+ messages in thread
From: Arnd Bergmann @ 2026-08-10 14:22 UTC (permalink / raw)
  To: André Almeida
  Cc: linux-kernel, Masami Hiramatsu, Nathan Chancellor,
	Thomas Gleixner, linux-kbuild, kernel-dev

On Mon, Aug 10, 2026, at 15:19, André Almeida wrote:
> Em 07/08/2026 17:40, Arnd Bergmann escreveu:
>> 
>> I don't see the purpose of this and would prefer to not add that
>> extra option if the scripts works fine without it.
>> 
>
> Some archs don't define __SYSCALL_WITH_COMPAT() (see x86_64 for 
> instance), so that's why I have added this option. But I can define 
> __SYSCALL_WITH_COMPAT() as SYSCALL(nr, native) for those archs.

Yes, I think that is the best solution here, yes. We certainly need
to use the compat version for .tbl files that only have one entry
but do use the compat ones (mips n32, arm64 aarch32), and using it
everywhere helps remove another special case here.

Side note: in the long run, I would hope we can remove those
intermediate macros entirely and just output a readable version
of the switch/case style top-level function that x86 generates
from the table.

      Arnd

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-08-10 14:23 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-07 19:34 [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 1/8] syscalls: Make --abis parsing more robust André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 2/8] syscalls: Create unified partial table for all archs André Almeida
2026-08-07 20:40   ` Arnd Bergmann
2026-08-10 13:19     ` André Almeida
2026-08-10 14:22       ` Arnd Bergmann
2026-08-07 19:34 ` [PATCH RFC v3 3/8] scripts/syscall.tbl: Use the common table André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 4/8] arm: Use the common syscall table André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 5/8] s390: " André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 6/8] sparc: " André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 7/8] mips: Remove duplicated syscallnr.sh André Almeida
2026-08-07 19:34 ` [PATCH RFC v3 8/8] mips: Use the common syscall table André Almeida
2026-08-07 21:02   ` Arnd Bergmann
2026-08-10 13:20     ` André Almeida
2026-08-07 20:43 ` [PATCH RFC v3 0/8] syscalls: Add a shared table for all archs Arnd Bergmann
2026-08-10 13:25   ` André Almeida
2026-08-10 14:18     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®