diff options
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 9e19976af727..7e2d3b91692d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1498,12 +1498,13 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
1498 | 1498 | ||
1499 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 1499 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
1500 | 1500 | ||
1501 | static atomic_t ftrace_retfunc_active; | 1501 | static atomic_t ftrace_graph_active; |
1502 | |||
1503 | /* The callback that hooks the return of a function */ | ||
1504 | trace_function_graph_t ftrace_graph_function = | ||
1505 | (trace_function_graph_t)ftrace_stub; | ||
1506 | 1502 | ||
1503 | /* The callbacks that hook a function */ | ||
1504 | trace_func_graph_ret_t ftrace_graph_return = | ||
1505 | (trace_func_graph_ret_t)ftrace_stub; | ||
1506 | trace_func_graph_ent_t ftrace_graph_entry = | ||
1507 | (trace_func_graph_ent_t)ftrace_stub; | ||
1507 | 1508 | ||
1508 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ | 1509 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ |
1509 | static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list) | 1510 | static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list) |
@@ -1569,7 +1570,8 @@ static int start_graph_tracing(void) | |||
1569 | return ret; | 1570 | return ret; |
1570 | } | 1571 | } |
1571 | 1572 | ||
1572 | int register_ftrace_graph(trace_function_graph_t func) | 1573 | int register_ftrace_graph(trace_func_graph_ret_t retfunc, |
1574 | trace_func_graph_ent_t entryfunc) | ||
1573 | { | 1575 | { |
1574 | int ret = 0; | 1576 | int ret = 0; |
1575 | 1577 | ||
@@ -1583,14 +1585,15 @@ int register_ftrace_graph(trace_function_graph_t func) | |||
1583 | ret = -EBUSY; | 1585 | ret = -EBUSY; |
1584 | goto out; | 1586 | goto out; |
1585 | } | 1587 | } |
1586 | atomic_inc(&ftrace_retfunc_active); | 1588 | atomic_inc(&ftrace_graph_active); |
1587 | ret = start_graph_tracing(); | 1589 | ret = start_graph_tracing(); |
1588 | if (ret) { | 1590 | if (ret) { |
1589 | atomic_dec(&ftrace_retfunc_active); | 1591 | atomic_dec(&ftrace_graph_active); |
1590 | goto out; | 1592 | goto out; |
1591 | } | 1593 | } |
1592 | ftrace_tracing_type = FTRACE_TYPE_RETURN; | 1594 | ftrace_tracing_type = FTRACE_TYPE_RETURN; |
1593 | ftrace_graph_function = func; | 1595 | ftrace_graph_return = retfunc; |
1596 | ftrace_graph_entry = entryfunc; | ||
1594 | ftrace_startup(); | 1597 | ftrace_startup(); |
1595 | 1598 | ||
1596 | out: | 1599 | out: |
@@ -1602,8 +1605,9 @@ void unregister_ftrace_graph(void) | |||
1602 | { | 1605 | { |
1603 | mutex_lock(&ftrace_sysctl_lock); | 1606 | mutex_lock(&ftrace_sysctl_lock); |
1604 | 1607 | ||
1605 | atomic_dec(&ftrace_retfunc_active); | 1608 | atomic_dec(&ftrace_graph_active); |
1606 | ftrace_graph_function = (trace_function_graph_t)ftrace_stub; | 1609 | ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; |
1610 | ftrace_graph_entry = (trace_func_graph_ent_t)ftrace_stub; | ||
1607 | ftrace_shutdown(); | 1611 | ftrace_shutdown(); |
1608 | /* Restore normal tracing type */ | 1612 | /* Restore normal tracing type */ |
1609 | ftrace_tracing_type = FTRACE_TYPE_ENTER; | 1613 | ftrace_tracing_type = FTRACE_TYPE_ENTER; |
@@ -1614,7 +1618,7 @@ void unregister_ftrace_graph(void) | |||
1614 | /* Allocate a return stack for newly created task */ | 1618 | /* Allocate a return stack for newly created task */ |
1615 | void ftrace_graph_init_task(struct task_struct *t) | 1619 | void ftrace_graph_init_task(struct task_struct *t) |
1616 | { | 1620 | { |
1617 | if (atomic_read(&ftrace_retfunc_active)) { | 1621 | if (atomic_read(&ftrace_graph_active)) { |
1618 | t->ret_stack = kmalloc(FTRACE_RETFUNC_DEPTH | 1622 | t->ret_stack = kmalloc(FTRACE_RETFUNC_DEPTH |
1619 | * sizeof(struct ftrace_ret_stack), | 1623 | * sizeof(struct ftrace_ret_stack), |
1620 | GFP_KERNEL); | 1624 | GFP_KERNEL); |
@@ -1638,5 +1642,3 @@ void ftrace_graph_exit_task(struct task_struct *t) | |||
1638 | } | 1642 | } |
1639 | #endif | 1643 | #endif |
1640 | 1644 | ||
1641 | |||
1642 | |||