Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 313623
b: refs/heads/master
c: ee456bb
h: refs/heads/master
i:
  313621: 517e0f6
  313619: deb2fb7
  313615: 095d322
v: v3
  • Loading branch information
Steven Rostedt authored and Benjamin Herrenschmidt committed Jul 3, 2012
1 parent 5a18cb8 commit 7947e6d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b81f18e55e9f4ea81759bcb00fea295de679bbe8
refs/heads/master: ee456bb346e75a9b6d941224b108250e6ee5f79f
52 changes: 52 additions & 0 deletions trunk/arch/powerpc/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,58 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
return ret;
}

static int __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
{
unsigned long ftrace_addr = (unsigned long)FTRACE_ADDR;
int ret;

ret = ftrace_update_record(rec, enable);

switch (ret) {
case FTRACE_UPDATE_IGNORE:
return 0;
case FTRACE_UPDATE_MAKE_CALL:
return ftrace_make_call(rec, ftrace_addr);
case FTRACE_UPDATE_MAKE_NOP:
return ftrace_make_nop(NULL, rec, ftrace_addr);
}

return 0;
}

void ftrace_replace_code(int enable)
{
struct ftrace_rec_iter *iter;
struct dyn_ftrace *rec;
int ret;

for (iter = ftrace_rec_iter_start(); iter;
iter = ftrace_rec_iter_next(iter)) {
rec = ftrace_rec_iter_record(iter);
ret = __ftrace_replace_code(rec, enable);
if (ret) {
ftrace_bug(ret, rec->ip);
return;
}
}
}

void arch_ftrace_update_code(int command)
{
if (command & FTRACE_UPDATE_CALLS)
ftrace_replace_code(1);
else if (command & FTRACE_DISABLE_CALLS)
ftrace_replace_code(0);

if (command & FTRACE_UPDATE_TRACE_FUNC)
ftrace_update_ftrace_func(ftrace_trace_function);

if (command & FTRACE_START_FUNC_RET)
ftrace_enable_ftrace_graph_caller();
else if (command & FTRACE_STOP_FUNC_RET)
ftrace_disable_ftrace_graph_caller();
}

int __init ftrace_dyn_arch_init(void *data)
{
/* caller expects data to be zero */
Expand Down

0 comments on commit 7947e6d

Please sign in to comment.