mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/3] checksyscalls: only run when necessary
@ 2026-04-02 14:36 Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-04-02 14:36 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 v3:
- Use $(addprefix) to print instance identification
- Link to v2: https://patch.msgid.link/20260324-kbuild-missing-syscalls-v2-0-651b8beb0bfd@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] 5+ messages in thread

* [PATCH v3 1/3] checksyscalls: move path to reference table to a variable
  2026-04-02 14:36 [PATCH v3 0/3] checksyscalls: only run when necessary Thomas Weißschuh
@ 2026-04-02 14:36 ` Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 2/3] checksyscalls: only run when necessary Thomas Weißschuh
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-04-02 14:36 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>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 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] 5+ messages in thread

* [PATCH v3 2/3] checksyscalls: only run when necessary
  2026-04-02 14:36 [PATCH v3 0/3] checksyscalls: only run when necessary Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
@ 2026-04-02 14:36 ` Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
  2026-04-02 20:20 ` [PATCH v3 0/3] checksyscalls: only run when necessary Nicolas Schier
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-04-02 14:36 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>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 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] 5+ messages in thread

* [PATCH v3 3/3] checksyscalls: move instance functionality into generic code
  2026-04-02 14:36 [PATCH v3 0/3] checksyscalls: only run when necessary Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
  2026-04-02 14:36 ` [PATCH v3 2/3] checksyscalls: only run when necessary Thomas Weißschuh
@ 2026-04-02 14:36 ` Thomas Weißschuh
  2026-04-02 20:20 ` [PATCH v3 0/3] checksyscalls: only run when necessary Nicolas Schier
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2026-04-02 14:36 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>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
---
 Kbuild             | 4 ++--
 arch/mips/Makefile | 6 ++----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/Kbuild b/Kbuild
index 515cc6a27477..a6a0192dea08 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    $< $(addprefix 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] 5+ messages in thread

* Re: [PATCH v3 0/3] checksyscalls: only run when necessary
  2026-04-02 14:36 [PATCH v3 0/3] checksyscalls: only run when necessary Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-04-02 14:36 ` [PATCH v3 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
@ 2026-04-02 20:20 ` Nicolas Schier
  3 siblings, 0 replies; 5+ messages in thread
From: Nicolas Schier @ 2026-04-02 20:20 UTC (permalink / raw)
  To: Arnd Bergmann, Thomas Bogendoerfer, Nathan Chancellor,
	Thomas Weißschuh
  Cc: linux-arch, linux-kernel, linux-mips, linux-kbuild

On Thu, 02 Apr 2026 16:36:17 +0200, Thomas Weißschuh wrote:
> checksyscalls: only run when necessary
> 
> 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.
> 
> [...]

Applied to kbuild/linux.git (kbuild-next-unstable), thanks!

[1/3] checksyscalls: move path to reference table to a variable
      https://git.kernel.org/kbuild/c/263246f2
[2/3] checksyscalls: only run when necessary
      https://git.kernel.org/kbuild/c/a414e4ba
[3/3] checksyscalls: move instance functionality into generic code
      https://git.kernel.org/kbuild/c/a46f42c3

Please look out for regression or issue reports or other follow up
comments, as they may result in the patch/series getting dropped,
reverted or modified (e.g. trailers). Patches applied to the
kbuild-next-unstable branch are accepted pending wider testing in
linux-next and any post-commit review; they will generally be moved
to the kbuild-next branch in about a week if no issues are found.

Best regards,
-- 
Nicolas



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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-02 14:36 [PATCH v3 0/3] checksyscalls: only run when necessary Thomas Weißschuh
2026-04-02 14:36 ` [PATCH v3 1/3] checksyscalls: move path to reference table to a variable Thomas Weißschuh
2026-04-02 14:36 ` [PATCH v3 2/3] checksyscalls: only run when necessary Thomas Weißschuh
2026-04-02 14:36 ` [PATCH v3 3/3] checksyscalls: move instance functionality into generic code Thomas Weißschuh
2026-04-02 20:20 ` [PATCH v3 0/3] checksyscalls: only run when necessary 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®