Messages in this thread | | | Date | Thu, 20 Aug 2009 10:25:59 -0700 | From | Josh Stone <> | Subject | Re: [PATCH] tracing: Move tracepoint callbacks into DEFINE |
| |
On 08/19/2009 09:13 AM, Jason Baron wrote: > On Tue, Aug 18, 2009 at 12:23:47AM -0700, Josh Stone wrote: >> --- a/kernel/tracepoint.c >> +++ b/kernel/tracepoint.c >> @@ -243,6 +243,11 @@ static void set_tracepoint(struct tracepoint_entry **entry, >> { >> WARN_ON(strcmp((*entry)->name, elem->name) != 0); >> >> + if (elem->regfunc && !elem->state && active) >> + elem->regfunc(); >> + else if (elem->unregfunc && elem->state && !active) >> + elem->unregfunc(); >> + >> /* >> * rcu_assign_pointer has a smp_wmb() which makes sure that the new >> * probe callbacks array is consistent before setting a pointer to it. >> @@ -262,6 +267,9 @@ static void set_tracepoint(struct tracepoint_entry **entry, >> */ >> static void disable_tracepoint(struct tracepoint *elem) >> { >> + if (elem->unregfunc && elem->state) >> + elem->unregfunc(); >> + >> elem->state = 0; >> rcu_assign_pointer(elem->funcs, NULL); >> } >> @@ -581,15 +589,13 @@ __initcall(init_tracepoints); >> >> #ifdef CONFIG_FTRACE_SYSCALLS >> >> -static DEFINE_MUTEX(regfunc_mutex); >> -static int sys_tracepoint_refcount; >> +static int sys_tracepoint_refcount; /* guarded by tracepoints_mutex */ >> >> 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) { >> @@ -598,7 +604,6 @@ void syscall_regfunc(void) >> read_unlock_irqrestore(&tasklist_lock, flags); >> } >> sys_tracepoint_refcount++; >> - mutex_unlock(®func_mutex); >> } >> >> void syscall_unregfunc(void) >> @@ -606,7 +611,6 @@ 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); >> @@ -615,6 +619,5 @@ void syscall_unregfunc(void) >> } while_each_thread(g, t); >> read_unlock_irqrestore(&tasklist_lock, flags); >> } >> - mutex_unlock(®func_mutex); >> } >> #endif > > if we disable, CONFIG_FTRACE_SYSCALLS, then we get undefined references > to syscall_regfunc, and syscall_unregfunc. So, i think we just need to > remove the 'CONFIG_FTRACE_SYSCALLS' ifdef here.
This CONFIG check was added by commit 60d970c2 to deal with missing TIF_SYSCALL_FTRACE. Perhaps the functions should just have their bodies #ifdef'ed?
Josh
| |