lkml.org 
[lkml]   [2009]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 2/4] tracing: Make syscall_(un)regfunc arch-specific
On Fri, Aug 21, 2009 at 09:58:43PM -0700, Josh Stone wrote:
> The bodies of syscall_regfunc and syscall_unregfunc need the
> arch-specific flag TIF_SYSCALL_TRACEPOINT, which only exists
> on x86 and s390, so they should live in arch-specific files.


Sh also does, but currently in a seperate development branch.
(Adding Paul Mundt in Cc to prevent from further linux-next breakage).



> +
> +#ifdef CONFIG_TRACEPOINTS
> +
> +static DEFINE_MUTEX(regfunc_mutex);
> +static int sys_tracepoint_refcount;
> +
> +void syscall_regfunc(void)
> +{
> + unsigned long flags;
> + struct task_struct *g, *t;
> +
> + mutex_lock(&regfunc_mutex);
> + if (!sys_tracepoint_refcount) {
> + read_lock_irqsave(&tasklist_lock, flags);
> + do_each_thread(g, t) {
> + set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> + } while_each_thread(g, t);
> + read_unlock_irqrestore(&tasklist_lock, flags);
> + }
> + sys_tracepoint_refcount++;
> + mutex_unlock(&regfunc_mutex);
> +}
> +
> +void syscall_unregfunc(void)
> +{
> + unsigned long flags;
> + struct task_struct *g, *t;
> +
> + mutex_lock(&regfunc_mutex);
> + sys_tracepoint_refcount--;
> + if (!sys_tracepoint_refcount) {
> + read_lock_irqsave(&tasklist_lock, flags);
> + do_each_thread(g, t) {
> + clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> + } while_each_thread(g, t);
> + read_unlock_irqrestore(&tasklist_lock, flags);
> + }
> + mutex_unlock(&regfunc_mutex);
> +}
> +#endif
> diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
> index a909afe..c2adbed 100644
> --- a/arch/x86/kernel/ptrace.c
> +++ b/arch/x86/kernel/ptrace.c
> @@ -1549,3 +1549,43 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
> tracehook_consider_fatal_signal(current, SIGTRAP))
> send_sigtrap(current, regs, 0, TRAP_BRKPT);
> }
> +
> +#ifdef CONFIG_TRACEPOINTS
> +
> +static DEFINE_MUTEX(regfunc_mutex);
> +static int sys_tracepoint_refcount;
> +
> +void syscall_regfunc(void)
> +{
> + unsigned long flags;
> + struct task_struct *g, *t;
> +
> + mutex_lock(&regfunc_mutex);
> + if (!sys_tracepoint_refcount) {
> + read_lock_irqsave(&tasklist_lock, flags);
> + do_each_thread(g, t) {
> + set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> + } while_each_thread(g, t);
> + read_unlock_irqrestore(&tasklist_lock, flags);
> + }
> + sys_tracepoint_refcount++;
> + mutex_unlock(&regfunc_mutex);
> +}
> +
> +void syscall_unregfunc(void)
> +{
> + unsigned long flags;
> + struct task_struct *g, *t;
> +
> + mutex_lock(&regfunc_mutex);
> + sys_tracepoint_refcount--;
> + if (!sys_tracepoint_refcount) {
> + read_lock_irqsave(&tasklist_lock, flags);
> + do_each_thread(g, t) {
> + clear_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT);
> + } while_each_thread(g, t);
> + read_unlock_irqrestore(&tasklist_lock, flags);
> + }
> + mutex_unlock(&regfunc_mutex);
> +}
> +#endif



I really don't like that.
See how the s390 and x86 version of the above code are completely
identical?

Please put this in kernel/ptrace.c

Thanks.



\
 
 \ /
  Last update: 2009-08-23 23:17    [W:0.150 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site