diff options
author | Abhishek Sagar <sagar.abhishek@gmail.com> | 2008-06-01 12:17:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-10 05:58:17 -0400 |
commit | eb9a7bf09172f409c10ec9560adeea95bb4045f5 (patch) | |
tree | 0773fb494daf7157396d6a2069fe8698bad315e5 /kernel/trace | |
parent | 1d74f2a0f64b4091e5e91b55ac1b17dff93f4b59 (diff) |
ftrace: add debugfs entry 'failures'
Identify functions which had their mcount call-site updates failed. This can
help us track functions which ftrace shouldn't fiddle with, and are thus not
being traced. If there is no race with any external agent which is modifying
the mcount call-site, then this file displays no entries (normal case).
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/ftrace.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a8929e4c77c1..ad568c742bfc 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -768,6 +768,7 @@ enum { | |||
768 | FTRACE_ITER_FILTER = (1 << 0), | 768 | FTRACE_ITER_FILTER = (1 << 0), |
769 | FTRACE_ITER_CONT = (1 << 1), | 769 | FTRACE_ITER_CONT = (1 << 1), |
770 | FTRACE_ITER_NOTRACE = (1 << 2), | 770 | FTRACE_ITER_NOTRACE = (1 << 2), |
771 | FTRACE_ITER_FAILURES = (1 << 3), | ||
771 | }; | 772 | }; |
772 | 773 | ||
773 | #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */ | 774 | #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */ |
@@ -799,9 +800,16 @@ t_next(struct seq_file *m, void *v, loff_t *pos) | |||
799 | } | 800 | } |
800 | } else { | 801 | } else { |
801 | rec = &iter->pg->records[iter->idx++]; | 802 | rec = &iter->pg->records[iter->idx++]; |
802 | if ((rec->flags & FTRACE_FL_FAILED) || | 803 | if ((!(iter->flags & FTRACE_ITER_FAILURES) && |
804 | (rec->flags & FTRACE_FL_FAILED)) || | ||
805 | |||
806 | ((iter->flags & FTRACE_ITER_FAILURES) && | ||
807 | (!(rec->flags & FTRACE_FL_FAILED) || | ||
808 | (rec->flags & FTRACE_FL_FREE))) || | ||
809 | |||
803 | ((iter->flags & FTRACE_ITER_FILTER) && | 810 | ((iter->flags & FTRACE_ITER_FILTER) && |
804 | !(rec->flags & FTRACE_FL_FILTER)) || | 811 | !(rec->flags & FTRACE_FL_FILTER)) || |
812 | |||
805 | ((iter->flags & FTRACE_ITER_NOTRACE) && | 813 | ((iter->flags & FTRACE_ITER_NOTRACE) && |
806 | !(rec->flags & FTRACE_FL_NOTRACE))) { | 814 | !(rec->flags & FTRACE_FL_NOTRACE))) { |
807 | rec = NULL; | 815 | rec = NULL; |
@@ -896,6 +904,24 @@ int ftrace_avail_release(struct inode *inode, struct file *file) | |||
896 | return 0; | 904 | return 0; |
897 | } | 905 | } |
898 | 906 | ||
907 | static int | ||
908 | ftrace_failures_open(struct inode *inode, struct file *file) | ||
909 | { | ||
910 | int ret; | ||
911 | struct seq_file *m; | ||
912 | struct ftrace_iterator *iter; | ||
913 | |||
914 | ret = ftrace_avail_open(inode, file); | ||
915 | if (!ret) { | ||
916 | m = (struct seq_file *)file->private_data; | ||
917 | iter = (struct ftrace_iterator *)m->private; | ||
918 | iter->flags = FTRACE_ITER_FAILURES; | ||
919 | } | ||
920 | |||
921 | return ret; | ||
922 | } | ||
923 | |||
924 | |||
899 | static void ftrace_filter_reset(int enable) | 925 | static void ftrace_filter_reset(int enable) |
900 | { | 926 | { |
901 | struct ftrace_page *pg; | 927 | struct ftrace_page *pg; |
@@ -1309,6 +1335,13 @@ static struct file_operations ftrace_avail_fops = { | |||
1309 | .release = ftrace_avail_release, | 1335 | .release = ftrace_avail_release, |
1310 | }; | 1336 | }; |
1311 | 1337 | ||
1338 | static struct file_operations ftrace_failures_fops = { | ||
1339 | .open = ftrace_failures_open, | ||
1340 | .read = seq_read, | ||
1341 | .llseek = seq_lseek, | ||
1342 | .release = ftrace_avail_release, | ||
1343 | }; | ||
1344 | |||
1312 | static struct file_operations ftrace_filter_fops = { | 1345 | static struct file_operations ftrace_filter_fops = { |
1313 | .open = ftrace_filter_open, | 1346 | .open = ftrace_filter_open, |
1314 | .read = ftrace_regex_read, | 1347 | .read = ftrace_regex_read, |
@@ -1386,6 +1419,11 @@ static __init int ftrace_init_debugfs(void) | |||
1386 | pr_warning("Could not create debugfs " | 1419 | pr_warning("Could not create debugfs " |
1387 | "'available_filter_functions' entry\n"); | 1420 | "'available_filter_functions' entry\n"); |
1388 | 1421 | ||
1422 | entry = debugfs_create_file("failures", 0444, | ||
1423 | d_tracer, NULL, &ftrace_failures_fops); | ||
1424 | if (!entry) | ||
1425 | pr_warning("Could not create debugfs 'failures' entry\n"); | ||
1426 | |||
1389 | entry = debugfs_create_file("set_ftrace_filter", 0644, d_tracer, | 1427 | entry = debugfs_create_file("set_ftrace_filter", 0644, d_tracer, |
1390 | NULL, &ftrace_filter_fops); | 1428 | NULL, &ftrace_filter_fops); |
1391 | if (!entry) | 1429 | if (!entry) |