Re: [PATCH v1 7/7] DCE/DSE: riscv: trim syscall tables
From: Zhangjin Wu
Date: Sat Oct 07 2023 - 09:36:18 EST
Hi, Arnd
> On Tue, Sep 26, 2023, at 00:43, Zhangjin Wu wrote:
> > When the maximum nr of the used syscalls is smaller than __NR_syscalls
> > (original syscalls total). It is able to update __NR_syscalls to
> > (maximum nr + 1) and further trim the '>= (maximum nr + 1)' part of the
> > syscall tables:
> >
> > For example:
> >
> > sys_call_table [143] = {
> > [0 ... 143 - 1] = sys_ni_syscall,
> > [64] = sys_write,
> > [93] = sys_exit,
> > [142] = sys_reboot,
> > }
> >
> > The >= 143 part of the syscall tables can be trimmed.
> >
> > At the same time, the syscall >= 143 from user space must be ignored
> > from do_trap_ecall_u() of traps.c.
> >
> > Signed-off-by: Zhangjin Wu <falcon@xxxxxxxxxxx>
> > ---
> > arch/riscv/include/asm/unistd.h | 2 ++
> > arch/riscv/kernel/Makefile | 2 ++
> > arch/riscv/kernel/syscalls/Makefile | 22 +++++++++++++++++++
> > .../kernel/syscalls/compat_syscall_table.c | 4 ++--
> > arch/riscv/kernel/syscalls/syscall_table.c | 4 ++--
> > 5 files changed, 30 insertions(+), 4 deletions(-)
>
> This bit feels like you are overoptimizing for a corner case:
> there is not much to be gained in terms of memory savings, but
> you add complexity in an area that I feel should be made common
> between architectures.
>
> I hope to get back to working on consolidating both the
> syscall.tbl input files and the build infrastructure for them
> across architectures, and you make that harder here, so I'd
> prefer you to drop this part, at least until the code is
> shared across all architectures.
>
Agree, let's drop it.
Thanks,
Zhangjin
> Arnd