public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory
@ 2024-11-11 13:45 Masahiro Yamada
  2024-11-11 13:45 ` [PATCH 2/3] s390/syscalls: remove unnecessary argument of filechk_syshdr Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-11 13:45 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390
  Cc: Christian Borntraeger, Sven Schnelle, Masahiro Yamada,
	Hendrik Brueckner, Martin Schwidefsky, linux-kernel

Building the kernel with ARCH=s390 creates a weird arch/arch/ directory.

  $ find arch/arch
  arch/arch
  arch/arch/s390
  arch/arch/s390/include
  arch/arch/s390/include/generated
  arch/arch/s390/include/generated/asm
  arch/arch/s390/include/generated/uapi
  arch/arch/s390/include/generated/uapi/asm

The root cause is 'targets' in arch/s390/kernel/syscalls/Makefile,
where the relative path is incorrect.

Strictly speaking, 'targets' was not necessary in the first place
because this Makefile uses 'filechk' instead of 'if_changed'.

However, this commit keeps it, as it will be useful when converting
'filechk' to 'if_changed' later.

Fixes: 5c75824d915e ("s390/syscalls: add Makefile to generate system call header files")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/s390/kernel/syscalls/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile
index 1bb78b9468e8..e85c14f9058b 100644
--- a/arch/s390/kernel/syscalls/Makefile
+++ b/arch/s390/kernel/syscalls/Makefile
@@ -12,7 +12,7 @@ kapi-hdrs-y := $(kapi)/unistd_nr.h
 uapi-hdrs-y := $(uapi)/unistd_32.h
 uapi-hdrs-y += $(uapi)/unistd_64.h
 
-targets += $(addprefix ../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
+targets += $(addprefix ../../../../,$(gen-y) $(kapi-hdrs-y) $(uapi-hdrs-y))
 
 PHONY += kapi uapi
 
-- 
2.43.0


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

* [PATCH 2/3] s390/syscalls: remove unnecessary argument of filechk_syshdr
  2024-11-11 13:45 [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Masahiro Yamada
@ 2024-11-11 13:45 ` Masahiro Yamada
  2024-11-11 13:45 ` [PATCH 3/3] s390/syscalls: convert filechk to if_changed Masahiro Yamada
  2024-11-11 19:00 ` [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Heiko Carstens
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-11 13:45 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390
  Cc: Christian Borntraeger, Sven Schnelle, Masahiro Yamada,
	linux-kernel

The filechk_syshdr macro receives $@ in both cases, making the argument
redundant.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/s390/kernel/syscalls/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile
index e85c14f9058b..3725dd88428c 100644
--- a/arch/s390/kernel/syscalls/Makefile
+++ b/arch/s390/kernel/syscalls/Makefile
@@ -23,7 +23,7 @@ uapi:	$(uapi-hdrs-y)
 # Create output directory if not already present
 $(shell mkdir -p $(uapi) $(kapi))
 
-filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$2" < $<
+filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$@" < $<
 
 filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
 
@@ -31,11 +31,11 @@ filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
 
 syshdr_abi_unistd_32 := common,32
 $(uapi)/unistd_32.h: $(syscall) FORCE
-	$(call filechk,syshdr,$@)
+	$(call filechk,syshdr)
 
 syshdr_abi_unistd_64 := common,64
 $(uapi)/unistd_64.h: $(syscall) FORCE
-	$(call filechk,syshdr,$@)
+	$(call filechk,syshdr)
 
 $(kapi)/syscall_table.h: $(syscall) FORCE
 	$(call filechk,syscalls)
-- 
2.43.0


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

* [PATCH 3/3] s390/syscalls: convert filechk to if_changed
  2024-11-11 13:45 [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Masahiro Yamada
  2024-11-11 13:45 ` [PATCH 2/3] s390/syscalls: remove unnecessary argument of filechk_syshdr Masahiro Yamada
@ 2024-11-11 13:45 ` Masahiro Yamada
  2024-11-11 19:00 ` [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Heiko Carstens
  2 siblings, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-11 13:45 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, linux-s390
  Cc: Christian Borntraeger, Sven Schnelle, Masahiro Yamada,
	linux-kernel

The filechk macro always executes the syscalltbl script (and discards
the output if there are no changes).

Using if_changed is more efficient because it avoids running the script
when the target is up-to-date and the command remains unchanged.

All other architectures use if_changed for generating syscall headers.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 arch/s390/kernel/syscalls/Makefile | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/arch/s390/kernel/syscalls/Makefile b/arch/s390/kernel/syscalls/Makefile
index 3725dd88428c..c5d958a09ff4 100644
--- a/arch/s390/kernel/syscalls/Makefile
+++ b/arch/s390/kernel/syscalls/Makefile
@@ -23,23 +23,26 @@ uapi:	$(uapi-hdrs-y)
 # Create output directory if not already present
 $(shell mkdir -p $(uapi) $(kapi))
 
-filechk_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$@" < $<
+quiet_cmd_syshdr = SYSHDR  $@
+      cmd_syshdr = $(CONFIG_SHELL) '$(systbl)' -H -a $(syshdr_abi_$(basetarget)) -f "$@" < $< > $@
 
-filechk_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $<
+quiet_cmd_sysnr = SYSNR   $@
+      cmd_sysnr = $(CONFIG_SHELL) '$(systbl)' -N -a $(sysnr_abi_$(basetarget)) < $< > $@
 
-filechk_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $<
+quiet_cmd_syscalls = SYSTBL  $@
+      cmd_syscalls = $(CONFIG_SHELL) '$(systbl)' -S < $< > $@
 
 syshdr_abi_unistd_32 := common,32
-$(uapi)/unistd_32.h: $(syscall) FORCE
-	$(call filechk,syshdr)
+$(uapi)/unistd_32.h: $(syscall) $(systbl) FORCE
+	$(call if_changed,syshdr)
 
 syshdr_abi_unistd_64 := common,64
-$(uapi)/unistd_64.h: $(syscall) FORCE
-	$(call filechk,syshdr)
+$(uapi)/unistd_64.h: $(syscall) $(systbl) FORCE
+	$(call if_changed,syshdr)
 
-$(kapi)/syscall_table.h: $(syscall) FORCE
-	$(call filechk,syscalls)
+$(kapi)/syscall_table.h: $(syscall) $(systbl) FORCE
+	$(call if_changed,syscalls)
 
 sysnr_abi_unistd_nr := common,32,64
-$(kapi)/unistd_nr.h: $(syscall) FORCE
-	$(call filechk,sysnr)
+$(kapi)/unistd_nr.h: $(syscall) $(systbl) FORCE
+	$(call if_changed,sysnr)
-- 
2.43.0


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

* Re: [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory
  2024-11-11 13:45 [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Masahiro Yamada
  2024-11-11 13:45 ` [PATCH 2/3] s390/syscalls: remove unnecessary argument of filechk_syshdr Masahiro Yamada
  2024-11-11 13:45 ` [PATCH 3/3] s390/syscalls: convert filechk to if_changed Masahiro Yamada
@ 2024-11-11 19:00 ` Heiko Carstens
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Carstens @ 2024-11-11 19:00 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Vasily Gorbik, Alexander Gordeev, linux-s390,
	Christian Borntraeger, Sven Schnelle, Hendrik Brueckner,
	Martin Schwidefsky, linux-kernel

On Mon, Nov 11, 2024 at 10:45:52PM +0900, Masahiro Yamada wrote:
> Building the kernel with ARCH=s390 creates a weird arch/arch/ directory.
> 
>   $ find arch/arch
>   arch/arch
>   arch/arch/s390
>   arch/arch/s390/include
>   arch/arch/s390/include/generated
>   arch/arch/s390/include/generated/asm
>   arch/arch/s390/include/generated/uapi
>   arch/arch/s390/include/generated/uapi/asm
> 
> The root cause is 'targets' in arch/s390/kernel/syscalls/Makefile,
> where the relative path is incorrect.
> 
> Strictly speaking, 'targets' was not necessary in the first place
> because this Makefile uses 'filechk' instead of 'if_changed'.
> 
> However, this commit keeps it, as it will be useful when converting
> 'filechk' to 'if_changed' later.
> 
> Fixes: 5c75824d915e ("s390/syscalls: add Makefile to generate system call header files")
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  arch/s390/kernel/syscalls/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Oh wow, this survived nearly seven years. Thanks for fixing!
Applied all three patchs.

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

end of thread, other threads:[~2024-11-11 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 13:45 [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Masahiro Yamada
2024-11-11 13:45 ` [PATCH 2/3] s390/syscalls: remove unnecessary argument of filechk_syshdr Masahiro Yamada
2024-11-11 13:45 ` [PATCH 3/3] s390/syscalls: convert filechk to if_changed Masahiro Yamada
2024-11-11 19:00 ` [PATCH 1/3] s390/syscalls: avoid creation of arch/arch/ directory Heiko Carstens

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