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
768768 FTRACE_ITER_FILTER = (1 << 0),
769769 FTRACE_ITER_CONT = (1 << 1),
770770 FTRACE_ITER_NOTRACE = (1 << 2),
771+ FTRACE_ITER_FAILURES = (1 << 3),
771772 };
772773
773774 #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
799800 }
800801 } else {
801802 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+
803810 ((iter->flags & FTRACE_ITER_FILTER) &&
804811 !(rec->flags & FTRACE_FL_FILTER)) ||
812+
805813 ((iter->flags & FTRACE_ITER_NOTRACE) &&
806814 !(rec->flags & FTRACE_FL_NOTRACE))) {
807815 rec = NULL;
@@ -896,6 +904,24 @@ int ftrace_avail_release(struct inode *inode, struct file *file) · 88 unmodified lines
896904 return 0;
897905 }
898906
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+
899925 static void ftrace_filter_reset(int enable)
900926 {
901927 struct ftrace_page *pg;
@@ -1309,6 +1335,13 @@ static struct file_operations ftrace_avail_fops = { · 407 unmodified lines
13091335 .release = ftrace_avail_release,
13101336 };
13111337
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+
13121345 static struct file_operations ftrace_filter_fops = {
13131346 .open = ftrace_filter_open,
13141347 .read = ftrace_regex_read,
@@ -1386,6 +1419,11 @@ static __init int ftrace_init_debugfs(void) · 71 unmodified lines
13861419 pr_warning("Could not create debugfs "
13871420 "'available_filter_functions' entry\n");
13881421
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+
13891427 entry = debugfs_create_file("set_ftrace_filter", 0644, d_tracer,
13901428 NULL, &ftrace_filter_fops);
13911429 if (!entry)