Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158401
b: refs/heads/master
c: 64fbcd1
h: refs/heads/master
i:
  158399: 48f0504
v: v3
  • Loading branch information
Xiao Guangrong authored and Frederic Weisbecker committed Jul 17, 2009
1 parent 2182c98 commit 06640a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 55 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: da706d8bc833e7153622435560422e653bdb2e94
refs/heads/master: 64fbcd162819bddaf0d99e78b16371b655aa5dee
72 changes: 18 additions & 54 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,71 +1017,35 @@ static int
__ftrace_replace_code(struct dyn_ftrace *rec, int enable)
{
unsigned long ftrace_addr;
unsigned long ip, fl;
unsigned long flag = 0UL;

ftrace_addr = (unsigned long)FTRACE_ADDR;

ip = rec->ip;

/*
* If this record is not to be traced and
* it is not enabled then do nothing.
* If this record is not to be traced or we want to disable it,
* then disable it.
*
* If this record is not to be traced and
* it is enabled then disable it.
* If we want to enable it and filtering is off, then enable it.
*
* If we want to enable it and filtering is on, enable it only if
* it's filtered
*/
if (rec->flags & FTRACE_FL_NOTRACE) {
if (rec->flags & FTRACE_FL_ENABLED)
rec->flags &= ~FTRACE_FL_ENABLED;
else
return 0;

} else if (ftrace_filtered && enable) {
/*
* Filtering is on:
*/

fl = rec->flags & (FTRACE_FL_FILTER | FTRACE_FL_ENABLED);

/* Record is filtered and enabled, do nothing */
if (fl == (FTRACE_FL_FILTER | FTRACE_FL_ENABLED))
return 0;

/* Record is not filtered or enabled, do nothing */
if (!fl)
return 0;

/* Record is not filtered but enabled, disable it */
if (fl == FTRACE_FL_ENABLED)
rec->flags &= ~FTRACE_FL_ENABLED;
else
/* Otherwise record is filtered but not enabled, enable it */
rec->flags |= FTRACE_FL_ENABLED;
} else {
/* Disable or not filtered */

if (enable) {
/* if record is enabled, do nothing */
if (rec->flags & FTRACE_FL_ENABLED)
return 0;

rec->flags |= FTRACE_FL_ENABLED;

} else {
if (enable && !(rec->flags & FTRACE_FL_NOTRACE)) {
if (!ftrace_filtered || (rec->flags & FTRACE_FL_FILTER))
flag = FTRACE_FL_ENABLED;
}

/* if record is not enabled, do nothing */
if (!(rec->flags & FTRACE_FL_ENABLED))
return 0;
/* If the state of this record hasn't changed, then do nothing */
if ((rec->flags & FTRACE_FL_ENABLED) == flag)
return 0;

rec->flags &= ~FTRACE_FL_ENABLED;
}
if (flag) {
rec->flags |= FTRACE_FL_ENABLED;
return ftrace_make_call(rec, ftrace_addr);
}

if (rec->flags & FTRACE_FL_ENABLED)
return ftrace_make_call(rec, ftrace_addr);
else
return ftrace_make_nop(NULL, rec, ftrace_addr);
rec->flags &= ~FTRACE_FL_ENABLED;
return ftrace_make_nop(NULL, rec, ftrace_addr);
}

static void ftrace_replace_code(int enable)
Expand Down

0 comments on commit 06640a3

Please sign in to comment.