2015-05-06 13:47:53

by Chen Gang

[permalink] [raw]
Subject: [PATCH] cris: Wire up missing syscalls

The related warnings:

CALL scripts/checksyscalls.sh
<stdin>:1229:2: warning: #warning syscall sched_setattr not implemented [-Wcpp]
<stdin>:1232:2: warning: #warning syscall sched_getattr not implemented [-Wcpp]
<stdin>:1235:2: warning: #warning syscall renameat2 not implemented [-Wcpp]
<stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
<stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
<stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
<stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
<stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]

Signed-off-by: Chen Gang <[email protected]>
---
arch/cris/arch-v10/kernel/entry.S | 8 ++++++++
arch/cris/arch-v32/kernel/entry.S | 8 ++++++++
arch/cris/include/uapi/asm/unistd.h | 8 ++++++++
3 files changed, 24 insertions(+)

diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 81570fc..d94c520 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -955,6 +955,14 @@ sys_call_table:
.long sys_process_vm_writev
.long sys_kcmp /* 350 */
.long sys_finit_module
+ .long _sys_sched_setattr
+ .long _sys_sched_getattr
+ .long _sys_renameat2
+ .long _sys_seccomp /* 355 */
+ .long _sys_getrandom
+ .long _sys_memfd_create
+ .long _sys_bpf
+ .long _sys_execveat

/*
* NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 026a0b2..62a82d8 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -875,6 +875,14 @@ sys_call_table:
.long sys_process_vm_writev
.long sys_kcmp /* 350 */
.long sys_finit_module
+ .long _sys_sched_setattr
+ .long _sys_sched_getattr
+ .long _sys_renameat2
+ .long _sys_seccomp /* 355 */
+ .long _sys_getrandom
+ .long _sys_memfd_create
+ .long _sys_bpf
+ .long _sys_execveat

/*
* NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/include/uapi/asm/unistd.h b/arch/cris/include/uapi/asm/unistd.h
index f3287fa..062b648 100644
--- a/arch/cris/include/uapi/asm/unistd.h
+++ b/arch/cris/include/uapi/asm/unistd.h
@@ -356,5 +356,13 @@
#define __NR_process_vm_writev 349
#define __NR_kcmp 350
#define __NR_finit_module 351
+#define __NR_sched_setattr 352
+#define __NR_sched_getattr 353
+#define __NR_renameat2 354
+#define __NR_seccomp 355
+#define __NR_getrandom 356
+#define __NR_memfd_create 357
+#define __NR_bpf 358
+#define __NR_execveat 359

#endif /* _UAPI_ASM_CRIS_UNISTD_H_ */
--
1.9.3


2015-06-03 10:20:20

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls


On Wed, May 06, 2015 at 03:48:12PM +0200, Chen Gang wrote:
> The related warnings:
>
> CALL scripts/checksyscalls.sh
> <stdin>:1229:2: warning: #warning syscall sched_setattr not implemented [-Wcpp]
> <stdin>:1232:2: warning: #warning syscall sched_getattr not implemented [-Wcpp]
> <stdin>:1235:2: warning: #warning syscall renameat2 not implemented [-Wcpp]
> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>
> Signed-off-by: Chen Gang <[email protected]>

Thanks and applied, sorry for the long delay, I had to rewrite the patch a bit
since the v10 and v32 does not have the same standard in prefixing underscores.
Also, to be safe I also bumped the NR_syscalls as below.

---
arch/cris/arch-v10/kernel/entry.S | 8 ++++++++
arch/cris/arch-v32/kernel/entry.S | 8 ++++++++
arch/cris/include/asm/unistd.h | 2 +-
arch/cris/include/uapi/asm/unistd.h | 8 ++++++++
4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 81570fc..d94c520 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -955,6 +955,14 @@ sys_call_table:
.long sys_process_vm_writev
.long sys_kcmp /* 350 */
.long sys_finit_module
+ .long _sys_sched_setattr
+ .long _sys_sched_getattr
+ .long _sys_renameat2
+ .long _sys_seccomp /* 355 */
+ .long _sys_getrandom
+ .long _sys_memfd_create
+ .long _sys_bpf
+ .long _sys_execveat

/*
* NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
index 026a0b2..1c5595a 100644
--- a/arch/cris/arch-v32/kernel/entry.S
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -875,6 +875,14 @@ sys_call_table:
.long sys_process_vm_writev
.long sys_kcmp /* 350 */
.long sys_finit_module
+ .long sys_sched_setattr
+ .long sys_sched_getattr
+ .long sys_renameat2
+ .long sys_seccomp /* 355 */
+ .long sys_getrandom
+ .long sys_memfd_create
+ .long sys_bpf
+ .long sys_execveat

/*
* NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
index 0f40fed..9c23535 100644
--- a/arch/cris/include/asm/unistd.h
+++ b/arch/cris/include/asm/unistd.h
@@ -4,7 +4,7 @@
#include <uapi/asm/unistd.h>


-#define NR_syscalls 360
+#define NR_syscalls 365

#include <arch/unistd.h>

diff --git a/arch/cris/include/uapi/asm/unistd.h b/arch/cris/include/uapi/asm/unistd.h
index f3287fa..062b648 100644
--- a/arch/cris/include/uapi/asm/unistd.h
+++ b/arch/cris/include/uapi/asm/unistd.h
@@ -356,5 +356,13 @@
#define __NR_process_vm_writev 349
#define __NR_kcmp 350
#define __NR_finit_module 351
+#define __NR_sched_setattr 352
+#define __NR_sched_getattr 353
+#define __NR_renameat2 354
+#define __NR_seccomp 355
+#define __NR_getrandom 356
+#define __NR_memfd_create 357
+#define __NR_bpf 358
+#define __NR_execveat 359

#endif /* _UAPI_ASM_CRIS_UNISTD_H_ */
--
1.7.10.4


/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2015-06-03 11:37:04

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On 06/03/2015 06:20 PM, Jesper Nilsson wrote:
>
> On Wed, May 06, 2015 at 03:48:12PM +0200, Chen Gang wrote:
>> The related warnings:
>>
>> CALL scripts/checksyscalls.sh
>> <stdin>:1229:2: warning: #warning syscall sched_setattr not implemented [-Wcpp]
>> <stdin>:1232:2: warning: #warning syscall sched_getattr not implemented [-Wcpp]
>> <stdin>:1235:2: warning: #warning syscall renameat2 not implemented [-Wcpp]
>> <stdin>:1238:2: warning: #warning syscall seccomp not implemented [-Wcpp]
>> <stdin>:1241:2: warning: #warning syscall getrandom not implemented [-Wcpp]
>> <stdin>:1244:2: warning: #warning syscall memfd_create not implemented [-Wcpp]
>> <stdin>:1247:2: warning: #warning syscall bpf not implemented [-Wcpp]
>> <stdin>:1250:2: warning: #warning syscall execveat not implemented [-Wcpp]
>>
>> Signed-off-by: Chen Gang <[email protected]>
>
> Thanks and applied, sorry for the long delay, I had to rewrite the patch a bit
> since the v10 and v32 does not have the same standard in prefixing underscores.
> Also, to be safe I also bumped the NR_syscalls as below.
>

Oh, it doesn't matter, everyone's time resources are expensive, so I
should/can understand your delay response.

I also delayed many things, e.g. I planed to wire up all syscalls for
all archs within 2015-05-31, but I delayed (2 another archs: frv and
m32r are still left, I shall try to send patches for them, next).

- One main excuse is I have to devote much free time resources on qemu,
which I have delayed too much to bear (now, I am still trying).

- The other reason is frv upstream compiler can be built, but can not
work at all, I have to analyse it firstly.

Sorry for my carelessness: use "_sys*", and keep original NR_syscalls no
touch. And also 3 additional things I guess we may need a look:

- For v10, need we also use "sys*" instead of "_sys*"?

- Most archs do not implement seccomp and bpf, which can pass building,
but will return -ENOSYS during running. Need we left them still as
warnings? (I guess, it depends on the maintainer's taste).

- In the latest next tree, it also add additional userfaultfd syscall,
need we add it, too?


Thanks.

> ---
> arch/cris/arch-v10/kernel/entry.S | 8 ++++++++
> arch/cris/arch-v32/kernel/entry.S | 8 ++++++++
> arch/cris/include/asm/unistd.h | 2 +-
> arch/cris/include/uapi/asm/unistd.h | 8 ++++++++
> 4 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
> index 81570fc..d94c520 100644
> --- a/arch/cris/arch-v10/kernel/entry.S
> +++ b/arch/cris/arch-v10/kernel/entry.S
> @@ -955,6 +955,14 @@ sys_call_table:
> .long sys_process_vm_writev
> .long sys_kcmp /* 350 */
> .long sys_finit_module
> + .long _sys_sched_setattr
> + .long _sys_sched_getattr
> + .long _sys_renameat2
> + .long _sys_seccomp /* 355 */
> + .long _sys_getrandom
> + .long _sys_memfd_create
> + .long _sys_bpf
> + .long _sys_execveat
>
> /*
> * NOTE!! This doesn't have to be exact - we just have
> diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
> index 026a0b2..1c5595a 100644
> --- a/arch/cris/arch-v32/kernel/entry.S
> +++ b/arch/cris/arch-v32/kernel/entry.S
> @@ -875,6 +875,14 @@ sys_call_table:
> .long sys_process_vm_writev
> .long sys_kcmp /* 350 */
> .long sys_finit_module
> + .long sys_sched_setattr
> + .long sys_sched_getattr
> + .long sys_renameat2
> + .long sys_seccomp /* 355 */
> + .long sys_getrandom
> + .long sys_memfd_create
> + .long sys_bpf
> + .long sys_execveat
>
> /*
> * NOTE!! This doesn't have to be exact - we just have
> diff --git a/arch/cris/include/asm/unistd.h b/arch/cris/include/asm/unistd.h
> index 0f40fed..9c23535 100644
> --- a/arch/cris/include/asm/unistd.h
> +++ b/arch/cris/include/asm/unistd.h
> @@ -4,7 +4,7 @@
> #include <uapi/asm/unistd.h>
>
>
> -#define NR_syscalls 360
> +#define NR_syscalls 365
>
> #include <arch/unistd.h>
>
> diff --git a/arch/cris/include/uapi/asm/unistd.h b/arch/cris/include/uapi/asm/unistd.h
> index f3287fa..062b648 100644
> --- a/arch/cris/include/uapi/asm/unistd.h
> +++ b/arch/cris/include/uapi/asm/unistd.h
> @@ -356,5 +356,13 @@
> #define __NR_process_vm_writev 349
> #define __NR_kcmp 350
> #define __NR_finit_module 351
> +#define __NR_sched_setattr 352
> +#define __NR_sched_getattr 353
> +#define __NR_renameat2 354
> +#define __NR_seccomp 355
> +#define __NR_getrandom 356
> +#define __NR_memfd_create 357
> +#define __NR_bpf 358
> +#define __NR_execveat 359
>
> #endif /* _UAPI_ASM_CRIS_UNISTD_H_ */
>

--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-06-03 15:04:37

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On Wed, Jun 03, 2015 at 01:36:47PM +0200, Chen Gang wrote:
> On 06/03/2015 06:20 PM, Jesper Nilsson wrote:
> > On Wed, May 06, 2015 at 03:48:12PM +0200, Chen Gang wrote:
> >> The related warnings:
> >> Signed-off-by: Chen Gang <[email protected]>
> > Thanks and applied, sorry for the long delay, I had to rewrite the patch a bit
> > since the v10 and v32 does not have the same standard in prefixing underscores.
> > Also, to be safe I also bumped the NR_syscalls as below.
> >
>
> Oh, it doesn't matter, everyone's time resources are expensive, so I
> should/can understand your delay response.

Thanks for understanding.

> Sorry for my carelessness: use "_sys*", and keep original NR_syscalls no
> touch. And also 3 additional things I guess we may need a look:
>
> - For v10, need we also use "sys*" instead of "_sys*"?

No, the trick here is that v10 and v32 uses different standards
with regards to prefixing underscore. I'm hoping to fix that someday.

> - Most archs do not implement seccomp and bpf, which can pass building,
> but will return -ENOSYS during running. Need we left them still as
> warnings? (I guess, it depends on the maintainer's taste).

Well, I don't have any strong feelings in either direction. :-)

> - In the latest next tree, it also add additional userfaultfd syscall,
> need we add it, too?

Hm, haven't seen that syscall, I'm guessing it's in linux-next?

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2015-06-03 15:23:20

by Hans-Peter Nilsson

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

> From: Jesper Nilsson <[email protected]>
> Date: Wed, 3 Jun 2015 17:04:26 +0200

> On Wed, Jun 03, 2015 at 01:36:47PM +0200, Chen Gang wrote:
> > - For v10, need we also use "sys*" instead of "_sys*"?
>
> No, the trick here is that v10 and v32 uses different standards
> with regards to prefixing underscore. I'm hoping to fix that someday.

Not exactly, but almost; please let me fill in JFTR:

Most people probably guessed correctly that this is related to
building the CRIS v10 kernel with the *-elf toolchain (which has
the convention that symbols are prefixed with underscores for
cris-*-elf and crisv32-*-elf) while (IIUC) the CRIS v32 kernel
is built with the *-linux-gnu toolchain (which does not have any
symbol prefix for cris-*-linux-gnu crisv32-*-linux-gnu).

One Might Imagine that there'd be build machinery in place in
the kernel such that such a symbol prefix issue could be hidden,
like a header to include and using e.g. S(symbol) in all
assembly files. (Actually some time ago I thought there already
was, but Jesper corrected me.)

brgds, H-P

2015-06-04 07:20:43

by Jesper Nilsson

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On Wed, Jun 03, 2015 at 05:04:26PM +0200, Jesper Nilsson wrote:
> On Wed, Jun 03, 2015 at 01:36:47PM +0200, Chen Gang wrote:
> > - For v10, need we also use "sys*" instead of "_sys*"?
>
> No, the trick here is that v10 and v32 uses different standards
> with regards to prefixing underscore. I'm hoping to fix that someday.

... and as your autotest found, this was a real problem.
I'll push a new commit to drop the underscore for v10 also.

BR,

/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]

2015-06-04 12:47:00

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On 06/04/2015 03:20 PM, Jesper Nilsson wrote:
> On Wed, Jun 03, 2015 at 05:04:26PM +0200, Jesper Nilsson wrote:
>> On Wed, Jun 03, 2015 at 01:36:47PM +0200, Chen Gang wrote:
>>> - For v10, need we also use "sys*" instead of "_sys*"?
>>
>> No, the trick here is that v10 and v32 uses different standards
>> with regards to prefixing underscore. I'm hoping to fix that someday.
>
> ... and as your autotest found, this was a real problem.
> I'll push a new commit to drop the underscore for v10 also.
>

Thank you for your work.

And "kbuild test robot" found it (not me). :-)

Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-06-04 12:48:46

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On 06/04/2015 03:20 PM, Jesper Nilsson wrote:
> On Wed, Jun 03, 2015 at 05:04:26PM +0200, Jesper Nilsson wrote:
>> On Wed, Jun 03, 2015 at 01:36:47PM +0200, Chen Gang wrote:
>>> - For v10, need we also use "sys*" instead of "_sys*"?
>>
>> No, the trick here is that v10 and v32 uses different standards
>> with regards to prefixing underscore. I'm hoping to fix that someday.
>
> ... and as your autotest found, this was a real problem.
> I'll push a new commit to drop the underscore for v10 also.
>

Thank you for your work.

And "kbuild test robot" found it (not me). :-)

--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-06-06 00:15:05

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On 6/3/15 23:23, Hans-Peter Nilsson wrote:
>
> Most people probably guessed correctly that this is related to
> building the CRIS v10 kernel with the *-elf toolchain (which has
> the convention that symbols are prefixed with underscores for
> cris-*-elf and crisv32-*-elf) while (IIUC) the CRIS v32 kernel
> is built with the *-linux-gnu toolchain (which does not have any
> symbol prefix for cris-*-linux-gnu crisv32-*-linux-gnu).
>

What you said above is helpful to me. Originally I often use *-elf for
cross compiling linux kernel, it is incorrect for some archs (e.g. frv,
m32r, and our cris).

After use *-linux, the upstream frv toolchain can work well (for me, it
is the last arch which has missing syscalls). :-)


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

2015-06-06 00:15:30

by Chen Gang

[permalink] [raw]
Subject: Re: [PATCH] cris: Wire up missing syscalls

On 6/3/15 23:23, Hans-Peter Nilsson wrote:
>
> Most people probably guessed correctly that this is related to
> building the CRIS v10 kernel with the *-elf toolchain (which has
> the convention that symbols are prefixed with underscores for
> cris-*-elf and crisv32-*-elf) while (IIUC) the CRIS v32 kernel
> is built with the *-linux-gnu toolchain (which does not have any
> symbol prefix for cris-*-linux-gnu crisv32-*-linux-gnu).
>

What you said above is helpful to me. Originally I often use *-elf for
cross compiling linux kernel, it is incorrect for some archs.

After use *-linux, the upstream frv toolchain can work well (for me, it
is the last arch which has missing syscalls). :-)


Thanks.
--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed