History

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).

Abhishek Sagar committed 18 years ago

Commit eb9a7bf1 parent 1d74f2a1 file · +39 −1Browse files

Showing the changes to kernel/trace (1 of 1 file). Show all

Unified · Split

kernel/trace/ftrace.c+39−1
@@ -768,6 +768,7 @@ enum { · 767 unmodified lines
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) · 25 unmodified lines
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) · 88 unmodified lines
896 return 0;904 return 0;
897}905}
898 906
907static int
908ftrace_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
899static void ftrace_filter_reset(int enable)925static 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 = { · 407 unmodified lines
1309 .release = ftrace_avail_release,1335 .release = ftrace_avail_release,
1310};1336};
1311 1337
1338static 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
1312static struct file_operations ftrace_filter_fops = {1345static 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) · 71 unmodified lines
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)