# Re: \[PATCH 09/19\] LoongArch: Add system call support

- From: Huacai Chen \<hidden\>
- Date: 2021-07-07 04:24:41 
- List: linux-arch
- Page: https://ratatoskr.run/linux-arch/2021/07/13337072
- Thread: https://ratatoskr.run/linux-arch/2021/07/13337006/t.md

```text
Hi, Arnd,

On Tue, Jul 6, 2021 at 6:17 PM Arnd Bergmann [ref] wrote:
>
> On Tue, Jul 6, 2021 at 6:18 AM Huacai Chen [ref] wrote:
>
> > diff --git a/arch/loongarch/include/asm/seccomp.h b/arch/loongarch/include/asm/seccomp.h
> > new file mode 100644
> > index 000000000000..220c885f5478
> > --- /dev/null
> > +++ b/arch/loongarch/include/asm/seccomp.h
> > @@ -0,0 +1,9 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef __ASM_SECCOMP_H
> > +#define __ASM_SECCOMP_H
> > +
> > +#include <linux/unistd.h>
> > +
> > +#include <asm-generic/seccomp.h>
> > +
> > +#endif /* __ASM_SECCOMP_H */
>
> I would expect this file to not be needed.
>
> > diff --git a/arch/loongarch/include/asm/uaccess.h b/arch/loongarch/include/asm/uaccess.h
> > new file mode 100644
> > index 000000000000..b760aa0a3bc6
> > --- /dev/null
> > +++ b/arch/loongarch/include/asm/uaccess.h
> > @@ -0,0 +1,453 @@
> > + * The fs value determines whether argument validity checking should be
> > + * performed or not.  If get_fs() == USER_DS, checking is performed, with
> > + * get_fs() == KERNEL_DS, checking is bypassed.
> > + *
> > + * For historical reasons, these macros are grossly misnamed.
> > + */
>
> You removed set_fs()/get_fs(), which is good, but you forgot to remove
> the comment.
OK, thanks.

>
> > diff --git a/arch/loongarch/include/uapi/asm/unistd.h b/arch/loongarch/include/uapi/asm/unistd.h
> > new file mode 100644
> > index 000000000000..6c194d740ed0
> > --- /dev/null
> > +++ b/arch/loongarch/include/uapi/asm/unistd.h
> > @@ -0,0 +1,7 @@
> > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> > +#define __ARCH_WANT_NEW_STAT
>
> Why do you need newstat? I think now that we have statx and the libc
> emulation code on top of it, there is probably no need to support both
> on the kernel side.
>
> > +#define __ARCH_WANT_SYS_CLONE
> > +#define __ARCH_WANT_SYS_CLONE3
>
> Similarly, if you have clone3, you should not need clone.
>
> > +#define __ARCH_WANT_SET_GET_RLIMIT
>
> And here for prlimit64
Is newstat()/clone()/setrlimit() completely unacceptable in a new
arch? If not, I want to keep it here for compatibility, because there
are some existing distros.

>
>
> > +void *sys_call_table[__NR_syscalls] = {
> > +       [0 ... __NR_syscalls - 1] = sys_ni_syscall,
> > +#include <asm/unistd.h>
> > +       __SYSCALL(__NR_clone, __sys_clone)
> > +       __SYSCALL(__NR_clone3, __sys_clone3)
> > +};
>
> I would suggest expressing this as
>
> #defined sys_clone3 __sys_clone3
>
> instead of overriding the other entries.
OK, thanks.

Huacai
>
>           Arnd
```
