Re: [PATCH v1 4/7] DCE/DSE: mips: add HAVE_TRIM_UNUSED_SYSCALLS support

From: Zhangjin Wu
Date: Sat Oct 07 2023 - 08:58:39 EST


Hi, Arnd

> On Tue, Sep 26, 2023, at 00:40, Zhangjin Wu wrote:
> > For HAVE_TRIM_UNUSED_SYSCALLS, the syscall tables are hacked with the
> > input used syscalls.
> >
> > Based on the used syscalls information, a new version of tbl file is
> > generated from the original tbl file and named with a 'used' suffix.
> >
> > With this new tbl file, both unistd_nr_*.h and syscall_table_*.h files
> > are updated to only include the used syscalls.
> >
> > $ grep _Linux_syscalls -ur arch/mips/include/generated/asm/
> > arch/mips/include/generated/asm/unistd_nr_n64.h:#define
> > __NR_64_Linux_syscalls 165
> > arch/mips/include/generated/asm/unistd_nr_n32.h:#define
> > __NR_N32_Linux_syscalls 165
> > arch/mips/include/generated/asm/unistd_nr_o32.h:#define
> > __NR_O32_Linux_syscalls 89
> >
> > $ grep -vr sys_ni_syscall
> > arch/mips/include/generated/asm/syscall_table_*.h
> > arch/mips/include/generated/asm/syscall_table_n32.h:__SYSCALL(58,
> > sys_exit)
> > arch/mips/include/generated/asm/syscall_table_n32.h:__SYSCALL(164,
> > sys_reboot)
> > arch/mips/include/generated/asm/syscall_table_n64.h:__SYSCALL(58,
> > sys_exit)
>
> My feeling is that instead of postprocessing the generated files,
> it would be much better to make the elimination part of the
> existing infrastructure that generates the files from syscall.tbl,
> and finally change the include/asm-generic/unistd.h to the
> same format, as we had planned for a long time.
>

Agree very much, then we can simply touch the common files, no need to
touch the arch specific files.

> I should be able to help out with that part.
>

Thanks, is it enough to touch these ones?

$ ls scripts/syscall*
scripts/syscallhdr.sh scripts/syscallnr.sh scripts/syscalltbl.sh

One question here is that is it possible or required to share the used syscalls
selection code among them?

Another question require your help is the compat part, the compat stuff makes
things harder (include the Kconfig symbol interface definition and select
logic), perhaps we can simply limit our first DSE version under !COMPAT?

Best regards,
Zhangjin

> Arnd