Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
On 23.6.2010 12:37, Andi Kleen wrote: It also has maintenance costs, e.g. I doubt ctags and cscope will be able to deal with these kinds of macros, so it has a high cost for everyone using these tools. FWIW, patch 16/40 of this series teaches 'make tags' to recognize these macros: http://permalink.gmane.org/gmane.linux.kernel/1002103 Michal ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 31/40] trace syscalls: Convert various generic compat syscalls
From: Ian Munsie imun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Signed-off-by: Ian Munsie imun...@au1.ibm.com --- fs/compat.c|2 +- fs/compat_ioctl.c |4 ++-- ipc/compat_mq.c| 24 kernel/futex_compat.c | 19 ++- kernel/kexec.c |8 kernel/ptrace.c|4 ++-- kernel/sysctl_binary.c |2 +- mm/mempolicy.c | 19 ++- net/compat.c | 28 ++-- 9 files changed, 56 insertions(+), 54 deletions(-) diff --git a/fs/compat.c b/fs/compat.c index df0b502..9897b7b 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1823,7 +1823,7 @@ struct compat_sel_arg_struct { compat_uptr_t tvp; }; -asmlinkage long compat_sys_old_select(struct compat_sel_arg_struct __user *arg) +COMPAT_SYSCALL_DEFINE1(old_select, struct compat_sel_arg_struct __user *, arg) { struct compat_sel_arg_struct a; diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 641640d..60d7e91 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c @@ -1674,8 +1674,8 @@ static int compat_ioctl_check_table(unsigned int xcmd) return ioctl_pointer[i] == xcmd; } -asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd, - unsigned long arg) +COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, + unsigned long, arg) { struct file *filp; int error = -EBADF; diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c index d8d1e9f..53593d3 100644 --- a/ipc/compat_mq.c +++ b/ipc/compat_mq.c @@ -46,9 +46,9 @@ static inline int put_compat_mq_attr(const struct mq_attr *attr, | __put_user(attr-mq_curmsgs, uattr-mq_curmsgs); } -asmlinkage long compat_sys_mq_open(const char __user *u_name, - int oflag, compat_mode_t mode, - struct compat_mq_attr __user *u_attr) +COMPAT_SYSCALL_DEFINE4(mq_open, const char __user *, u_name, + int, oflag, compat_mode_t, mode, + struct compat_mq_attr __user *, u_attr) { void __user *p = NULL; if (u_attr oflag O_CREAT) { @@ -75,10 +75,10 @@ static int compat_prepare_timeout(struct timespec __user * *p, return 0; } -asmlinkage long compat_sys_mq_timedsend(mqd_t mqdes, - const char __user *u_msg_ptr, - size_t msg_len, unsigned int msg_prio, - const struct compat_timespec __user *u_abs_timeout) +COMPAT_SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, + const char __user *, u_msg_ptr, + size_t, msg_len, unsigned int, msg_prio, + const struct compat_timespec __user *, u_abs_timeout) { struct timespec __user *u_ts; @@ -102,8 +102,8 @@ asmlinkage ssize_t compat_sys_mq_timedreceive(mqd_t mqdes, u_msg_prio, u_ts); } -asmlinkage long compat_sys_mq_notify(mqd_t mqdes, - const struct compat_sigevent __user *u_notification) +COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, + const struct compat_sigevent __user *, u_notification) { struct sigevent __user *p = NULL; if (u_notification) { @@ -119,9 +119,9 @@ asmlinkage long compat_sys_mq_notify(mqd_t mqdes, return sys_mq_notify(mqdes, p); } -asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, - const struct compat_mq_attr __user *u_mqstat, - struct compat_mq_attr __user *u_omqstat) +COMPAT_SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes, + const struct compat_mq_attr __user *, u_mqstat, + struct compat_mq_attr __user *, u_omqstat) { struct mq_attr mqstat; struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p)); diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c index d49afb2..d798c9f 100644 --- a/kernel/futex_compat.c +++ b/kernel/futex_compat.c @@ -10,6 +10,7 @@ #include linux/compat.h #include linux/nsproxy.h #include linux/futex.h +#include linux/syscalls.h #include asm/uaccess.h @@ -114,9 +115,9 @@ void compat_exit_robust_list(struct task_struct *curr) } } -asmlinkage long -compat_sys_set_robust_list(struct compat_robust_list_head __user *head, - compat_size_t len) +COMPAT_SYSCALL_DEFINE2(set_robust_list, + struct compat_robust_list_head __user *, head, + compat_size_t, len) { if (!futex_cmpxchg_enabled) return -ENOSYS; @@ -129,9 +130,9 @@ compat_sys_set_robust_list(struct compat_robust_list_head __user *head, return 0; } -asmlinkage long -compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr, -
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote: , Ian Munsie wrote: From: Ian Munsieimun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Why? This just makes the code look uglier and the functions harder to grep for. Because it makes them usable with syscall tracing. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
, Ian Munsie wrote: From: Ian Munsieimun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Why? This just makes the code look uglier and the functions harder to grep for. -Andi ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
, Frederic Weisbecker wrote: On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote: , Ian Munsie wrote: From: Ian Munsieimun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Why? This just makes the code look uglier and the functions harder to grep for. Because it makes them usable with syscall tracing. Ok that information is missing in the changelog then. Also I hope the uglification-usefullness factor is really worth it. The patch is certainly no slouch on the uglification side. It also has maintenance costs, e.g. I doubt ctags and cscope will be able to deal with these kinds of macros, so it has a high cost for everyone using these tools. For those it would be actually better if you used separate annotation that does not confuse standard C parsers. -Andi ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
, Ian Munsie wrote: From: Ian Munsieimun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Why? This just makes the code look uglier and the functions harder to grep for. I guess trace-syscall feature need to override COMPAT_SYSCALL_DEFINE. but It's only guess... ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
On Wed, Jun 23, 2010 at 12:37:44PM +0200, Andi Kleen wrote: , Frederic Weisbecker wrote: On Wed, Jun 23, 2010 at 12:19:38PM +0200, Andi Kleen wrote: , Ian Munsie wrote: From: Ian Munsieimun...@au1.ibm.com This patch converts numerous trivial compat syscalls through the generic kernel code to use the COMPAT_SYSCALL_DEFINE family of macros. Why? This just makes the code look uglier and the functions harder to grep for. Because it makes them usable with syscall tracing. Ok that information is missing in the changelog then. Agreed, the changelog lacks the purpose of what it does. Also I hope the uglification-usefullness factor is really worth it. The patch is certainly no slouch on the uglification side. It's worth because the kernel's syscall tracing is not complete, we lack all the compat part. These wrappers let us create TRACE_EVENT() for every syscalls automatically. If we had to create them manually, the uglification would be way much more worse. Most syscalls use the syscall wrappers already, so the uglification is there mostly. We just forgot to uglify a bunch of them :) It also has maintenance costs, e.g. I doubt ctags and cscope will be able to deal with these kinds of macros, so it has a high cost for everyone using these tools. For those it would be actually better if you used separate annotation that does not confuse standard C parsers. I haven't heard any complains about existing syscalls wrappers. What kind of annotations could solve that? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
I haven't heard any complains about existing syscalls wrappers. At least for me they always interrupt my grepping. What kind of annotations could solve that? If you put the annotation in a separate macro and leave the original prototype alone. Then C parsers could still parse it. -Andi ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
On Wed, Jun 23, 2010 at 02:35:38PM +0200, Andi Kleen wrote: I haven't heard any complains about existing syscalls wrappers. At least for me they always interrupt my grepping. What kind of annotations could solve that? If you put the annotation in a separate macro and leave the original prototype alone. Then C parsers could still parse it. I personally hate the way SYSCALL_DEFINE works with passion, mostly for the grep reason, but also because it looks horribly ugly. But there is no reason not to be consistent here. We already use the wrappers for all native system calls, so leaving the compat calls out doesn't make any sense. And I'd cheer for anyone who comes up with a better scheme for the native and compat wrappers. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 31/40] trace syscalls: Convert various generic compat syscalls
On 06/23/2010 04:38 AM, Frederic Weisbecker wrote: I haven't heard any complains about existing syscalls wrappers. Then you truly haven't been listening. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev