Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245455
b: refs/heads/master
c: b9df92d
h: refs/heads/master
i:
  245453: 88f8843
  245451: d90df4e
  245447: 7526f3d
  245439: a6e7f35
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Apr 30, 2011
1 parent 9150e41 commit 88ebd58
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 63 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: 491d0dcfb9707e1f83eff93ca503eb7573162ef2
refs/heads/master: b9df92d2a94eef8811061aecb1396290df440e2e
98 changes: 36 additions & 62 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1726,34 +1726,52 @@ update_record(struct dyn_ftrace *rec, unsigned long flag, int not)
}

static int
ftrace_match_record(struct dyn_ftrace *rec, char *regex, int len, int type)
ftrace_match_record(struct dyn_ftrace *rec, char *mod,
char *regex, int len, int type)
{
char str[KSYM_SYMBOL_LEN];
char *modname;

kallsyms_lookup(rec->ip, NULL, NULL, &modname, str);

if (mod) {
/* module lookup requires matching the module */
if (!modname || strcmp(modname, mod))
return 0;

/* blank search means to match all funcs in the mod */
if (!len)
return 1;
}

kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
return ftrace_match(str, regex, len, type);
}

static int ftrace_match_records(char *buff, int len, int enable)
static int match_records(char *buff, int len, char *mod, int enable, int not)
{
unsigned int search_len;
unsigned search_len = 0;
struct ftrace_page *pg;
struct dyn_ftrace *rec;
int type = MATCH_FULL;
char *search = buff;
unsigned long flag;
char *search;
int type;
int not;
int found = 0;

flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;
type = filter_parse_regex(buff, len, &search, &not);
if (len) {
type = filter_parse_regex(buff, len, &search, &not);
search_len = strlen(search);
}

search_len = strlen(search);
flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;

mutex_lock(&ftrace_lock);

if (unlikely(ftrace_disabled))
goto out_unlock;

do_for_each_ftrace_rec(pg, rec) {

if (ftrace_match_record(rec, search, search_len, type)) {
if (ftrace_match_record(rec, mod, search, search_len, type)) {
update_record(rec, flag, not);
found = 1;
}
Expand All @@ -1763,43 +1781,23 @@ static int ftrace_match_records(char *buff, int len, int enable)
*/
if (enable && (rec->flags & FTRACE_FL_FILTER))
ftrace_filtered = 1;

} while_for_each_ftrace_rec();
out_unlock:
mutex_unlock(&ftrace_lock);

return found;
}

static int
ftrace_match_module_record(struct dyn_ftrace *rec, char *mod,
char *regex, int len, int type)
ftrace_match_records(char *buff, int len, int enable)
{
char str[KSYM_SYMBOL_LEN];
char *modname;

kallsyms_lookup(rec->ip, NULL, NULL, &modname, str);

if (!modname || strcmp(modname, mod))
return 0;

/* blank search means to match all funcs in the mod */
if (len)
return ftrace_match(str, regex, len, type);
else
return 1;
return match_records(buff, len, NULL, enable, 0);
}

static int ftrace_match_module_records(char *buff, char *mod, int enable)
{
unsigned search_len = 0;
struct ftrace_page *pg;
struct dyn_ftrace *rec;
int type = MATCH_FULL;
char *search = buff;
unsigned long flag;
int not = 0;
int found = 0;

flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;

/* blank or '*' mean the same */
if (strcmp(buff, "*") == 0)
Expand All @@ -1811,31 +1809,7 @@ static int ftrace_match_module_records(char *buff, char *mod, int enable)
not = 1;
}

if (strlen(buff)) {
type = filter_parse_regex(buff, strlen(buff), &search, &not);
search_len = strlen(search);
}

mutex_lock(&ftrace_lock);

if (unlikely(ftrace_disabled))
goto out_unlock;

do_for_each_ftrace_rec(pg, rec) {

if (ftrace_match_module_record(rec, mod,
search, search_len, type)) {
update_record(rec, flag, not);
found = 1;
}
if (enable && (rec->flags & FTRACE_FL_FILTER))
ftrace_filtered = 1;

} while_for_each_ftrace_rec();
out_unlock:
mutex_unlock(&ftrace_lock);

return found;
return match_records(buff, strlen(buff), mod, enable, not);
}

/*
Expand Down Expand Up @@ -1993,7 +1967,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,

do_for_each_ftrace_rec(pg, rec) {

if (!ftrace_match_record(rec, search, len, type))
if (!ftrace_match_record(rec, NULL, search, len, type))
continue;

entry = kmalloc(sizeof(*entry), GFP_KERNEL);
Expand Down Expand Up @@ -2548,7 +2522,7 @@ ftrace_set_func(unsigned long *array, int *idx, char *buffer)
if (rec->flags & FTRACE_FL_FREE)
continue;

if (ftrace_match_record(rec, search, search_len, type)) {
if (ftrace_match_record(rec, NULL, search, search_len, type)) {
/* if it is in the array */
exists = false;
for (i = 0; i < *idx; i++) {
Expand Down

0 comments on commit 88ebd58

Please sign in to comment.