diff mbox series

[2/2] sh: generate uapi header and syscall table header files

Message ID 1546443445-21075-3-git-send-email-firoz.khan@linaro.org (mailing list archive)
State New, archived
Headers show
Series sh: Unify the system call scripts | expand

Commit Message

Firoz Khan Jan. 2, 2019, 3:37 p.m. UTC
Unified system call table generation script must be run to
generate unistd_32.h and syscall_table.h files. This patch
will have changes which will invokes the script.

This patch will generate unistd_32.h and syscall_table.h
files by the syscall table generation script invoked by
sh/Makefile and the generated files against the removed
files must be identical.

The generated uapi header file will be included in uapi/-
asm/unistd.h and generated system call table header file
will be included by kernel/syscall_32.S file.

Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
---
 arch/sh/kernel/syscalls/Makefile      | 11 +++++++++--
 arch/sh/kernel/syscalls/syscallhdr.sh | 36 -----------------------------------
 arch/sh/kernel/syscalls/syscalltbl.sh | 32 -------------------------------
 3 files changed, 9 insertions(+), 70 deletions(-)
 delete mode 100644 arch/sh/kernel/syscalls/syscallhdr.sh
 delete mode 100644 arch/sh/kernel/syscalls/syscalltbl.sh

Comments

Guenter Roeck Jan. 10, 2019, 11:54 p.m. UTC | #1
On Wed, Jan 02, 2019 at 09:07:25PM +0530, Firoz Khan wrote:
> Unified system call table generation script must be run to
> generate unistd_32.h and syscall_table.h files. This patch
> will have changes which will invokes the script.
> 
> This patch will generate unistd_32.h and syscall_table.h
> files by the syscall table generation script invoked by
> sh/Makefile and the generated files against the removed
> files must be identical.
> 
> The generated uapi header file will be included in uapi/-
> asm/unistd.h and generated system call table header file
> will be included by kernel/syscall_32.S file.
> 
> Signed-off-by: Firoz Khan <firoz.khan@linaro.org>

Have you tested this patch ?

Building sh:defconfig ... failed
--------------
Error log:
make[2]: *** No rule to make target
'/opt/buildbot/slave/next-next/build/scripts/syscalltbl.sh',
	needed by 'arch/sh/include/generated/asm/syscall_table.h'.  Stop.

This affects all 'sh' builds. Not surprisingly, reverting the patch fixes
the problem.

Guenter

---
# bad: [6cab33afc3dd17bd9922c99a828f5680b4667cd9] Add linux-next specific files for 20190110
# good: [bfeffd155283772bbe78c6a05dec7c0128ee500c] Linux 5.0-rc1
git bisect start 'HEAD' 'v5.0-rc1'
# good: [45daa05b201d684d42a186970731a9e39f75beb7] Merge remote-tracking branch 'mtd/mtd/next'
git bisect good 45daa05b201d684d42a186970731a9e39f75beb7
# good: [62d9bf7cbfd16d41f30de4439d7349c70d99923b] Merge remote-tracking branch 'tip/auto-latest'
git bisect good 62d9bf7cbfd16d41f30de4439d7349c70d99923b
# good: [cff8f6ab40ac1f5681ba37a663382d0c5d1b07d1] Merge remote-tracking branch 'vhost/linux-next'
git bisect good cff8f6ab40ac1f5681ba37a663382d0c5d1b07d1
# bad: [ed7209d69de4c01d589b030c34412d093aac3801] mm: initialize MAX_ORDER_NR_PAGES at a time instead of doing larger sections
git bisect bad ed7209d69de4c01d589b030c34412d093aac3801
# bad: [8fd9cdac0385dcec3534d79bf6ad29e33a6cfe1f] vmalloc: add test driver to analyse vmalloc allocator
git bisect bad 8fd9cdac0385dcec3534d79bf6ad29e33a6cfe1f
# good: [e804aa1e321d349514c121c3bff66dee1cff3dd5] sh: remove nargs from __SYSCALL
git bisect good e804aa1e321d349514c121c3bff66dee1cff3dd5
# bad: [7f3303ead0bd6fc02ca0d5a2e6a3ce8f653afbea] mm: reuse only-pte-mapped KSM page in do_wp_page()
git bisect bad 7f3303ead0bd6fc02ca0d5a2e6a3ce8f653afbea
# bad: [7dc035ee0653362ae11187152ac5942e230fb523] fs/file.c: initialize init_files.resize_wait
git bisect bad 7dc035ee0653362ae11187152ac5942e230fb523
# bad: [539eec285bc3a61570493f08fca6d84e09e77d3c] ocfs2: clear zero in unaligned direct IO
git bisect bad 539eec285bc3a61570493f08fca6d84e09e77d3c
# bad: [63ef58895f79a7dea083dff346a6504b87e1a7dc] lib/debugobjects.c: move printk out of db lock critical sections
git bisect bad 63ef58895f79a7dea083dff346a6504b87e1a7dc
# bad: [60a47bb1b736b2be71ff6f256693595af5c707e8] sh: generate uapi header and syscall table header files
git bisect bad 60a47bb1b736b2be71ff6f256693595af5c707e8
# first bad commit: [60a47bb1b736b2be71ff6f256693595af5c707e8] sh: generate uapi header and syscall table header files
Rob Landley Jan. 12, 2019, 4:21 a.m. UTC | #2
On 1/10/19 5:54 PM, Guenter Roeck wrote:
> On Wed, Jan 02, 2019 at 09:07:25PM +0530, Firoz Khan wrote:
>> Unified system call table generation script must be run to
>> generate unistd_32.h and syscall_table.h files. This patch
>> will have changes which will invokes the script.
>>
>> This patch will generate unistd_32.h and syscall_table.h
>> files by the syscall table generation script invoked by
>> sh/Makefile and the generated files against the removed
>> files must be identical.
>>
>> The generated uapi header file will be included in uapi/-
>> asm/unistd.h and generated system call table header file
>> will be included by kernel/syscall_32.S file.
>>
>> Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
> 
> Have you tested this patch ?

I tested it at one point, but not recently. (It was before 4.20 came out...)

Rob
Geert Uytterhoeven Jan. 12, 2019, 9:22 a.m. UTC | #3
On Fri, Jan 11, 2019 at 1:37 AM Guenter Roeck <linux@roeck-us.net> wrote:
> On Wed, Jan 02, 2019 at 09:07:25PM +0530, Firoz Khan wrote:
> > Unified system call table generation script must be run to
> > generate unistd_32.h and syscall_table.h files. This patch
> > will have changes which will invokes the script.
> >
> > This patch will generate unistd_32.h and syscall_table.h
> > files by the syscall table generation script invoked by
> > sh/Makefile and the generated files against the removed
> > files must be identical.
> >
> > The generated uapi header file will be included in uapi/-
> > asm/unistd.h and generated system call table header file
> > will be included by kernel/syscall_32.S file.
> >
> > Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
>
> Have you tested this patch ?

All these series depend on "scripts: unify system call table generation
scripts"
https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@linaro.org/

Yeah, 0day also didn't know that.

Gr{oetje,eeting}s,

                        Geert
Firoz Khan Jan. 14, 2019, 7:59 a.m. UTC | #4
Hi Geert, Rob, Guenter,

Thanks for the mail.

On Sat, 12 Jan 2019 at 14:53, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> On Fri, Jan 11, 2019 at 1:37 AM Guenter Roeck <linux@roeck-us.net> wrote:
> > On Wed, Jan 02, 2019 at 09:07:25PM +0530, Firoz Khan wrote:
> > Have you tested this patch ?

Yes.

>
> All these series depend on "scripts: unify system call table generation
> scripts"
> https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@linaro.org/

Yes, This patch is depends on:
https://lore.kernel.org/lkml/1546439331-18646-1-git-send-email-firoz.khan@linaro.org/

FYI, I'm going to abandon this patch series (for other 9 architecture
also) and planning
to come up with asm-generic support along with this one. That can be
single patch
series. And everything can be landed in upstream in the same time.

Rob,

> I tested it at one point, but not recently. (It was before 4.20 came out...)

The one you tested is the previous version this patch series (w/o
unified script)

Thanks
Firoz
diff mbox series

Patch

diff --git a/arch/sh/kernel/syscalls/Makefile b/arch/sh/kernel/syscalls/Makefile
index 659faef..75c7421 100644
--- a/arch/sh/kernel/syscalls/Makefile
+++ b/arch/sh/kernel/syscalls/Makefile
@@ -6,8 +6,9 @@  _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)')	\
 	  $(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')
 
 syscall := $(srctree)/$(src)/syscall.tbl
-syshdr := $(srctree)/$(src)/syscallhdr.sh
-systbl := $(srctree)/$(src)/syscalltbl.sh
+syshdr := $(srctree)/scripts/syscallhdr.sh
+sysnr := $(srctree)/scripts/syscallnr.sh
+systbl := $(srctree)/scripts/syscalltbl.sh
 
 quiet_cmd_syshdr = SYSHDR  $@
       cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'	\
@@ -15,6 +16,12 @@  quiet_cmd_syshdr = SYSHDR  $@
 		   '$(syshdr_pfx_$(basetarget))'		\
 		   '$(syshdr_offset_$(basetarget))'
 
+quiet_cmd_sysnr = SYSNR  $@
+      cmd_sysnr = $(CONFIG_SHELL) '$(sysnr)' '$<' '$@'		\
+		  '$(sysnr_abis_$(basetarget))'			\
+		  '$(sysnr_pfx_$(basetarget))'			\
+		  '$(sysnr_offset_$(basetarget))'
+
 quiet_cmd_systbl = SYSTBL  $@
       cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'	\
 		   '$(systbl_abis_$(basetarget))'		\
diff --git a/arch/sh/kernel/syscalls/syscallhdr.sh b/arch/sh/kernel/syscalls/syscallhdr.sh
deleted file mode 100644
index 1de0334..0000000
--- a/arch/sh/kernel/syscalls/syscallhdr.sh
+++ /dev/null
@@ -1,36 +0,0 @@ 
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-
-in="$1"
-out="$2"
-my_abis=`echo "($3)" | tr ',' '|'`
-prefix="$4"
-offset="$5"
-
-fileguard=_UAPI_ASM_SH_`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 ; do
-		if [ -z "$offset" ]; then
-			printf "#define __NR_%s%s\t%s\n" \
-				"${prefix}" "${name}" "${nr}"
-		else
-			printf "#define __NR_%s%s\t(%s + %s)\n" \
-				"${prefix}" "${name}" "${offset}" "${nr}"
-		fi
-		nxt=$((nr+1))
-	done
-
-	printf "\n"
-	printf "#ifdef __KERNEL__\n"
-	printf "#define __NR_syscalls\t%s\n" "${nxt}"
-	printf "#endif\n"
-	printf "\n"
-	printf "#endif /* %s */" "${fileguard}"
-) > "$out"
diff --git a/arch/sh/kernel/syscalls/syscalltbl.sh b/arch/sh/kernel/syscalls/syscalltbl.sh
deleted file mode 100644
index 904b8e6..0000000
--- a/arch/sh/kernel/syscalls/syscalltbl.sh
+++ /dev/null
@@ -1,32 +0,0 @@ 
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0
-
-in="$1"
-out="$2"
-my_abis=`echo "($3)" | tr ',' '|'`
-my_abi="$4"
-offset="$5"
-
-emit() {
-	t_nxt="$1"
-	t_nr="$2"
-	t_entry="$3"
-
-	while [ $t_nxt -lt $t_nr ]; do
-		printf "__SYSCALL(%s,sys_ni_syscall)\n" "${t_nxt}"
-		t_nxt=$((t_nxt+1))
-	done
-	printf "__SYSCALL(%s,%s)\n" "${t_nxt}" "${t_entry}"
-}
-
-grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
-	nxt=0
-	if [ -z "$offset" ]; then
-		offset=0
-	fi
-
-	while read nr abi name entry ; do
-		emit $((nxt+offset)) $((nr+offset)) $entry
-		nxt=$((nr+1))
-	done
-) > "$out"