mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/3] checksyscalls: only run when necessary
@ 2026-03-24 17:16 Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2026-03-24 17:16 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor, Nicolas Schier
  Cc: linux-arch, linux-kernel, linux-mips, linux-kbuild,
	Thomas Weißschuh

Currently checksyscalls.sh is unconditionally executed during each build.
Most of these executions are unnecessary.

Only run checksyscalls.sh if one of its inputs have changed.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Also send to kbuild maintainers
- Link to v1: https://patch.msgid.link/20260303-kbuild-missing-syscalls-v1-0-3b4d69b68c75@weissschuh.net

---
Thomas Weißschuh (3):
      checksyscalls: move path to reference table to a variable
      checksyscalls: only run when necessary
      checksyscalls: move instance functionality into generic code

 Kbuild                   | 14 ++++++++++----
 arch/mips/Makefile       |  6 ++----
 scripts/checksyscalls.sh |  9 ++++++++-
 3 files changed, 20 insertions(+), 9 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260212-kbuild-missing-syscalls-e328de3c4b54

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


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

* [PATCH v2 1/3] checksyscalls: move path to reference table to a variable
  2026-03-24 17:16 [PATCH v2 0/3] checksyscalls: only run when necessary Thomas Weißschuh
@ 2026-03-24 17:16 ` Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 2/3] checksyscalls: only run when necessary Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2026-03-24 17:16 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor, Nicolas Schier
  Cc: linux-arch, linux-kernel, linux-mips, linux-kbuild,
	Thomas Weißschuh

An upcoming patch will need to reuse this path.

Move it into a reusable variable.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 scripts/checksyscalls.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 1e5d2eeb726d..9becaf8d7b78 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -10,6 +10,8 @@
 # checksyscalls.sh gcc gcc-options
 #
 
+reference_table="$(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl"
+
 ignore_list() {
 cat << EOF
 #include <asm/types.h>
@@ -269,5 +271,5 @@ syscall_list() {
 	done
 }
 
-(ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \
+(ignore_list && syscall_list ${reference_table}) | \
 $* -Wno-error -Wno-unused-macros -E -x c - > /dev/null

-- 
2.53.0


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

* [PATCH v2 2/3] checksyscalls: only run when necessary
  2026-03-24 17:16 [PATCH v2 0/3] checksyscalls: only run when necessary Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
@ 2026-03-24 17:16 ` Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
  2026-03-24 17:29 ` [PATCH v2 0/3] checksyscalls: only run when necessary Arnd Bergmann
  3 siblings, 0 replies; 7+ messages in thread
From: Thomas Weißschuh @ 2026-03-24 17:16 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor, Nicolas Schier
  Cc: linux-arch, linux-kernel, linux-mips, linux-kbuild,
	Thomas Weißschuh

Currently checksyscalls.sh is unconditionally executed during each build.
Most of these executions are unnecessary.

Only run checksyscalls.sh if one of its inputs have changed.

This new logic does not work for the multiple invocations done for MIPS.
The effect is that checksyscalls.sh is still executed unconditionally.
However this is not worse than before.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 Kbuild                   | 12 +++++++++---
 scripts/checksyscalls.sh |  5 +++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Kbuild b/Kbuild
index 13324b4bbe23..515cc6a27477 100644
--- a/Kbuild
+++ b/Kbuild
@@ -47,12 +47,18 @@ $(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
 
 # Check for missing system calls
 
+missing-syscalls-file := .tmp_missing-syscalls
+
+targets += $(missing-syscalls-file)
+
 quiet_cmd_syscalls = CALL    $<
-      cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags)
+      cmd_syscalls = DEPFILE=$(depfile) $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags); touch $@
+
+$(missing-syscalls-file): scripts/checksyscalls.sh $(rq-offsets-file) FORCE
+	$(call if_changed_dep,syscalls)
 
 PHONY += missing-syscalls
-missing-syscalls: scripts/checksyscalls.sh $(rq-offsets-file)
-	$(call cmd,syscalls)
+missing-syscalls: $(missing-syscalls-file)
 
 # Check the manual modification of atomic headers
 
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
index 9becaf8d7b78..a6d0882f07e1 100755
--- a/scripts/checksyscalls.sh
+++ b/scripts/checksyscalls.sh
@@ -273,3 +273,8 @@ syscall_list() {
 
 (ignore_list && syscall_list ${reference_table}) | \
 $* -Wno-error -Wno-unused-macros -E -x c - > /dev/null
+
+# For fixdep
+if [ -n "${DEPFILE}" ]; then
+	echo "${0}: ${0} ${reference_table}" >> "${DEPFILE}"
+fi

-- 
2.53.0


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

* [PATCH v2 3/3] checksyscalls: move instance functionality into generic code
  2026-03-24 17:16 [PATCH v2 0/3] checksyscalls: only run when necessary Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
  2026-03-24 17:16 ` [PATCH v2 2/3] checksyscalls: only run when necessary Thomas Weißschuh
@ 2026-03-24 17:16 ` Thomas Weißschuh
  2026-04-02 14:18   ` Nicolas Schier
  2026-03-24 17:29 ` [PATCH v2 0/3] checksyscalls: only run when necessary Arnd Bergmann
  3 siblings, 1 reply; 7+ messages in thread
From: Thomas Weißschuh @ 2026-03-24 17:16 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor, Nicolas Schier
  Cc: linux-arch, linux-kernel, linux-mips, linux-kbuild,
	Thomas Weißschuh

On MIPS the checksyscalls.sh script may be executed multiple times.
Currently these multiple executions are executed on each build as kbuild
see that the commands have changed each time.

Use a dedicated stamp file for each different invocation to avoid the
spurious executions.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 Kbuild             | 4 ++--
 arch/mips/Makefile | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Kbuild b/Kbuild
index 515cc6a27477..fb547bc5ff41 100644
--- a/Kbuild
+++ b/Kbuild
@@ -47,11 +47,11 @@ $(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
 
 # Check for missing system calls
 
-missing-syscalls-file := .tmp_missing-syscalls
+missing-syscalls-file := .tmp_missing-syscalls$(missing_syscalls_instance)
 
 targets += $(missing-syscalls-file)
 
-quiet_cmd_syscalls = CALL    $<
+quiet_cmd_syscalls = CALL    $< $(if $(missing_syscalls_instance),for $(missing_syscalls_instance))
       cmd_syscalls = DEPFILE=$(depfile) $(CONFIG_SHELL) $< $(CC) $(c_flags) $(missing_syscalls_flags); touch $@
 
 $(missing-syscalls-file): scripts/checksyscalls.sh $(rq-offsets-file) FORCE
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index d9057e29bc62..6705fa5d9211 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -421,12 +421,10 @@ CLEAN_FILES += vmlinux.32 vmlinux.64
 
 archprepare:
 ifdef CONFIG_MIPS32_N32
-	@$(kecho) '  Checking missing-syscalls for N32'
-	$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=n32"
+	$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="N32" missing_syscalls_flags="-mabi=n32"
 endif
 ifdef CONFIG_MIPS32_O32
-	@$(kecho) '  Checking missing-syscalls for O32'
-	$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_flags="-mabi=32"
+	$(Q)$(MAKE) $(build)=. missing-syscalls missing_syscalls_instance="O32" missing_syscalls_flags="-mabi=32"
 endif
 
 install:

-- 
2.53.0


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

* Re: [PATCH v2 0/3] checksyscalls: only run when necessary
  2026-03-24 17:16 [PATCH v2 0/3] checksyscalls: only run when necessary Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-03-24 17:16 ` [PATCH v2 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
@ 2026-03-24 17:29 ` Arnd Bergmann
  2026-04-02 14:18   ` Nicolas Schier
  3 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2026-03-24 17:29 UTC (permalink / raw)
  To: Thomas Weißschuh, Thomas Bogendoerfer, Nathan Chancellor,
	Nicolas Schier
  Cc: Linux-Arch, linux-kernel, linux-mips, linux-kbuild

On Tue, Mar 24, 2026, at 18:16, Thomas Weißschuh wrote:
> Currently checksyscalls.sh is unconditionally executed during each build.
> Most of these executions are unnecessary.
>
> Only run checksyscalls.sh if one of its inputs have changed.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Nice series!

Acked-by: Arnd Bergmann <arnd@arndb.de>

At some point, we should revisit the syscall table use and just have
a shared table across all architectures for the syscalls above 402,
which are almost identical already. That requires a bit of scripting
but will let us just drop the checksyscalls script that hasn't
been all that useful for a while now.

      Arnd

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

* Re: [PATCH v2 0/3] checksyscalls: only run when necessary
  2026-03-24 17:29 ` [PATCH v2 0/3] checksyscalls: only run when necessary Arnd Bergmann
@ 2026-04-02 14:18   ` Nicolas Schier
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-04-02 14:18 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Thomas Weißschuh, Thomas Bogendoerfer, Nathan Chancellor,
	Nicolas Schier, Linux-Arch, linux-kernel, linux-mips,
	linux-kbuild

On 2026-03-24 18:29:13+01:00, Arnd Bergmann wrote:
> On Tue, Mar 24, 2026, at 18:16, Thomas Weißschuh wrote:
> 
> > Currently checksyscalls.sh is unconditionally executed during each build.
> > Most of these executions are unnecessary.
> >
> > Only run checksyscalls.sh if one of its inputs have changed.
> >
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> 
> Nice series!
> 

yes, nice series with good ideas.  Thanks!


Reviewed-by: Nicolas Schier <nsc@kernel.org>


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

* Re: [PATCH v2 3/3] checksyscalls: move instance functionality into generic code
  2026-03-24 17:16 ` [PATCH v2 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
@ 2026-04-02 14:18   ` Nicolas Schier
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Schier @ 2026-04-02 14:18 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor,
	Nicolas Schier, linux-arch, linux-kernel, linux-mips,
	linux-kbuild

On Tue, 24 Mar 2026 18:16:47 +0100, Thomas Weißschuh <linux@weissschuh.net> wrote:
> diff --git a/Kbuild b/Kbuild
> index 515cc6a27477..fb547bc5ff41 100644
> --- a/Kbuild
> +++ b/Kbuild
> @@ -47,11 +47,11 @@ $(rq-offsets-file): kernel/sched/rq-offsets.s FORCE
>  
>  # Check for missing system calls
>  
> -missing-syscalls-file := .tmp_missing-syscalls
> +missing-syscalls-file := .tmp_missing-syscalls$(missing_syscalls_instance)
>  
>  targets += $(missing-syscalls-file)
>  
> -quiet_cmd_syscalls = CALL    $<
> +quiet_cmd_syscalls = CALL    $< $(if $(missing_syscalls_instance),for $(missing_syscalls_instance))

Nice solution!

$(addprefix) shortens a bit here:

quiet_cmd_syscalls = CALL    $< $(addprefix for ,$(missing_syscalls_instance))

-- 
Nicolas


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

end of thread, other threads:[~2026-04-02 14:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-24 17:16 [PATCH v2 0/3] checksyscalls: only run when necessary Thomas Weißschuh
2026-03-24 17:16 ` [PATCH v2 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
2026-03-24 17:16 ` [PATCH v2 2/3] checksyscalls: only run when necessary Thomas Weißschuh
2026-03-24 17:16 ` [PATCH v2 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
2026-04-02 14:18   ` Nicolas Schier
2026-03-24 17:29 ` [PATCH v2 0/3] checksyscalls: only run when necessary Arnd Bergmann
2026-04-02 14:18   ` Nicolas Schier

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®