Messages in this thread | | | Date | Sun, 23 Aug 2009 23:14:24 +0200 | From | Frederic Weisbecker <> | Subject | Re: [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(®func_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(®func_mutex); > +} > + > +void syscall_unregfunc(void) > +{ > + unsigned long flags; > + struct task_struct *g, *t; > + > + mutex_lock(®func_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(®func_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(®func_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(®func_mutex); > +} > + > +void syscall_unregfunc(void) > +{ > + unsigned long flags; > + struct task_struct *g, *t; > + > + mutex_lock(®func_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(®func_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.
| |