diff options
-rw-r--r-- | kernel/trace/ftrace.c | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 5dd332cc5aa8..065f1e61e103 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1703,6 +1703,7 @@ enum { | |||
1703 | FTRACE_ITER_NOTRACE = (1 << 1), | 1703 | FTRACE_ITER_NOTRACE = (1 << 1), |
1704 | FTRACE_ITER_PRINTALL = (1 << 2), | 1704 | FTRACE_ITER_PRINTALL = (1 << 2), |
1705 | FTRACE_ITER_HASH = (1 << 3), | 1705 | FTRACE_ITER_HASH = (1 << 3), |
1706 | FTRACE_ITER_ENABLED = (1 << 4), | ||
1706 | }; | 1707 | }; |
1707 | 1708 | ||
1708 | #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */ | 1709 | #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */ |
@@ -1842,7 +1843,11 @@ t_next(struct seq_file *m, void *v, loff_t *pos) | |||
1842 | !(ftrace_lookup_ip(ops->filter_hash, rec->ip))) || | 1843 | !(ftrace_lookup_ip(ops->filter_hash, rec->ip))) || |
1843 | 1844 | ||
1844 | ((iter->flags & FTRACE_ITER_NOTRACE) && | 1845 | ((iter->flags & FTRACE_ITER_NOTRACE) && |
1845 | !ftrace_lookup_ip(ops->notrace_hash, rec->ip))) { | 1846 | !ftrace_lookup_ip(ops->notrace_hash, rec->ip)) || |
1847 | |||
1848 | ((iter->flags & FTRACE_ITER_ENABLED) && | ||
1849 | !(rec->flags & ~FTRACE_FL_MASK))) { | ||
1850 | |||
1846 | rec = NULL; | 1851 | rec = NULL; |
1847 | goto retry; | 1852 | goto retry; |
1848 | } | 1853 | } |
@@ -1944,7 +1949,11 @@ static int t_show(struct seq_file *m, void *v) | |||
1944 | if (!rec) | 1949 | if (!rec) |
1945 | return 0; | 1950 | return 0; |
1946 | 1951 | ||
1947 | seq_printf(m, "%ps\n", (void *)rec->ip); | 1952 | seq_printf(m, "%ps", (void *)rec->ip); |
1953 | if (iter->flags & FTRACE_ITER_ENABLED) | ||
1954 | seq_printf(m, " (%ld)", | ||
1955 | rec->flags & ~FTRACE_FL_MASK); | ||
1956 | seq_printf(m, "\n"); | ||
1948 | 1957 | ||
1949 | return 0; | 1958 | return 0; |
1950 | } | 1959 | } |
@@ -1983,6 +1992,34 @@ ftrace_avail_open(struct inode *inode, struct file *file) | |||
1983 | return ret; | 1992 | return ret; |
1984 | } | 1993 | } |
1985 | 1994 | ||
1995 | static int | ||
1996 | ftrace_enabled_open(struct inode *inode, struct file *file) | ||
1997 | { | ||
1998 | struct ftrace_iterator *iter; | ||
1999 | int ret; | ||
2000 | |||
2001 | if (unlikely(ftrace_disabled)) | ||
2002 | return -ENODEV; | ||
2003 | |||
2004 | iter = kzalloc(sizeof(*iter), GFP_KERNEL); | ||
2005 | if (!iter) | ||
2006 | return -ENOMEM; | ||
2007 | |||
2008 | iter->pg = ftrace_pages_start; | ||
2009 | iter->flags = FTRACE_ITER_ENABLED; | ||
2010 | |||
2011 | ret = seq_open(file, &show_ftrace_seq_ops); | ||
2012 | if (!ret) { | ||
2013 | struct seq_file *m = file->private_data; | ||
2014 | |||
2015 | m->private = iter; | ||
2016 | } else { | ||
2017 | kfree(iter); | ||
2018 | } | ||
2019 | |||
2020 | return ret; | ||
2021 | } | ||
2022 | |||
1986 | static void ftrace_filter_reset(struct ftrace_hash *hash) | 2023 | static void ftrace_filter_reset(struct ftrace_hash *hash) |
1987 | { | 2024 | { |
1988 | mutex_lock(&ftrace_lock); | 2025 | mutex_lock(&ftrace_lock); |
@@ -2838,6 +2875,13 @@ static const struct file_operations ftrace_avail_fops = { | |||
2838 | .release = seq_release_private, | 2875 | .release = seq_release_private, |
2839 | }; | 2876 | }; |
2840 | 2877 | ||
2878 | static const struct file_operations ftrace_enabled_fops = { | ||
2879 | .open = ftrace_enabled_open, | ||
2880 | .read = seq_read, | ||
2881 | .llseek = seq_lseek, | ||
2882 | .release = seq_release_private, | ||
2883 | }; | ||
2884 | |||
2841 | static const struct file_operations ftrace_filter_fops = { | 2885 | static const struct file_operations ftrace_filter_fops = { |
2842 | .open = ftrace_filter_open, | 2886 | .open = ftrace_filter_open, |
2843 | .read = seq_read, | 2887 | .read = seq_read, |
@@ -3069,6 +3113,9 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) | |||
3069 | trace_create_file("available_filter_functions", 0444, | 3113 | trace_create_file("available_filter_functions", 0444, |
3070 | d_tracer, NULL, &ftrace_avail_fops); | 3114 | d_tracer, NULL, &ftrace_avail_fops); |
3071 | 3115 | ||
3116 | trace_create_file("enabled_functions", 0444, | ||
3117 | d_tracer, NULL, &ftrace_enabled_fops); | ||
3118 | |||
3072 | trace_create_file("set_ftrace_filter", 0644, d_tracer, | 3119 | trace_create_file("set_ftrace_filter", 0644, d_tracer, |
3073 | NULL, &ftrace_filter_fops); | 3120 | NULL, &ftrace_filter_fops); |
3074 | 3121 | ||