LoongArch/syscall: remove asm/unistd.h include from syscall.c
PATCH 1/1 LoongArch/syscall: remove asm/unistd.h include from syscall.c
At first glance, this inclusion looks weird. After digging further, I realized that there's no need to include the "asm/unistd.h" file. I've tested this patch for a few weeks, and didn't see any regressions. Therefore, removes the unnecessary inclusion.
--- arch/loongarch/kernel/syscall.c | 1 - 1 file changed, 1 deletion(-)
arch/loongarch/kernel/syscall.c +0 -1
@@ -31,7 +31,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,void *sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls -1 ] = sys_ni_syscall, -#include <asm/unistd.h> }; typedef long (*sys_call_fn)(unsigned long, unsigned long,
base-commit: 804f6d04b1adae9602edbd6410c0ba3a556964fe
Signature · 1 line
2.39.2
WANG Xuerui
reviewerQuoted 1 line · Enze Li
At first glance, this inclusion looks weird. After digging further, I
It's not weird, it's just overriding the fallback entries with actual function pointers for the existing supported syscalls.
Quoted 14 lines
realized that there's no need to include the "
asm/unistd.h" file. I've tested this patch for a few weeks, and didn't see any regressions. Therefore, removes the unnecessary inclusion.Signed-off-by Enze Li <[email protected]>--- arch/loongarch/kernel/syscall.c | 1 - 1 file changed, 1 deletion(-)arch/loongarch/kernel/syscall.c +0
-0
arch/loongarch/kernel/syscall.c SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, · line 34
Quoted 4 lines
arch/loongarch/kernel/syscall.c +0
-1@@ -31,7 +31,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,void *sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls -1 ] = sys_ni_syscall, -#include <asm/unistd.h>
Is this really supposed to work? You're removing *every* handler from the syscall table so every single syscall will just -ENOSYS. I don't believe you can test such a kernel "for a few weeks without regressions".
Quoted 5 lines
arch/loongarch/kernel/syscall.c +0
-0}; typedef long (*sys_call_fn)(unsigned long, unsigned long,base-commit:
804f6d04b1adae9602edbd6410c0ba3a556964fe
Signature · 3 lines
WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/
Hi Xuerui, Ruoyao,
Thanks for your swift reply.
Quoted 7 lines · WANG Xuerui
Quoted 2 lines · Enze Li
At first glance, this inclusion looks weird. After digging further, I
It's not weird, it's just overriding the fallback entries with actual
function pointers for the existing supported syscalls.
Thanks again for pointing out the actual mechanism.
It's clear that I should have checked the preprocessing source code while digging further.
Quoted 19 lines
Quoted 19 lines
realized that there's no need to include the "
asm/unistd.h" file. I've
tested this patch for a few weeks, and didn't see any regressions. Therefore, removes the unnecessary inclusion.Signed-off-by Enze Li <[email protected]>--- arch/loongarch/kernel/syscall.c | 1 - 1 file changed, 1 deletion(-)arch/loongarch/kernel/syscall.c +0
-0@@ -31,7 +31,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,
Quoted 9 lines
arch/loongarch/kernel/syscall.c SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long, · line 34
Quoted 3 lines
arch/loongarch/kernel/syscall.c +0
-1void *sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls -1 ] = sys_ni_syscall, -#include <asm/unistd.h> Is this really supposed to work? You're removing *every* handler from
the syscall table so every single syscall will just-ENOSYS. I don't believe you can test such a kernel "for a few weeks without regressions".
Oops! Sorry about that, I've been kind of flaky these days :( Maybe some other patches, I'm not quite sure.
Anyway, I'll devote more attention to the following work (Especially for testing). Please drop this one as it is unnecessary.
Best Regards,
Enze
Quoted 6 lines
Quoted 6 lines
arch/loongarch/kernel/syscall.c +0
-0};typedef long (*sys_call_fn)(unsigned long, unsigned long,
base-commit:
804f6d04b1adae9602edbd6410c0ba3a556964fe
Quoted 2 lines · Enze Li
At first glance, this inclusion looks weird. After digging further, I realized that there's no need to include the "
asm/unistd.h" file.
How did you get this conclusion? When I run "make arch/loongarch/kernel/syscall.i" it seems the preprocessed result indeed contains some entries imported from asm/unistd.h:
void *sys_call_table[451] = {
[0 ... 451 - 1] = sys_ni_syscall,
# 1 "./arch/loongarch/include/asm/unistd.h" 1 # 9 "./arch/loongarch/include/asm/unistd.h" # 1 "./arch/loongarch/include/uapi/asm/unistd.h" 1 # 1 "./include/uapi/asm-generic/unistd.h" 1 # 34 "./include/uapi/asm-generic/unistd.h"
[0] = (sys_io_setup),
[1] = (sys_io_destroy),
[2] = (sys_io_submit),
[3] = (sys_io_cancel),
[4] = (sys_io_getevents),
/* snip */
Quoted 1 line
I've tested this patch for a few weeks, and didn't see any regressions.
Frankly, I can't believe this.
Quoted 23 lines
Therefore, removes the unnecessary inclusion.
Signed-off-by Enze Li <[email protected]>---
arch/loongarch/kernel/syscall.c | 1 -1 file changed, 1 deletion(-)arch/loongarch/kernel/syscall.c +0
-0@@ -31,7 +31,6 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, unsigned long,
void *sys_call_table[__NR_syscalls] = {
[0 ...__NR_syscalls- 1] =sys_ni_syscall, -#include <asm/unistd.h>
};
typedef long (*sys_call_fn)(unsigned long, unsigned long,base-commit:
804f6d04b1adae9602edbd6410c0ba3a556964fe
Signature · 2 lines
Xi Ruoyao <[email protected]> School of Aerospace Science and Technology, Xidian University