aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-05-05 22:54:01 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-05-18 19:22:52 -0400
commit936e074b286ae779f134312178dbab139ee7ea52 (patch)
tree6b0497be4d5e6258ad9b1ec99b2a9feb25b2dd22 /kernel/trace
parentcdbe61bfe70440939e457fb4a8d0995eaaed17de (diff)
ftrace: Modify ftrace_set_filter/notrace to take ops
Since users of the function tracer can now pick and choose which functions they want to trace agnostically from other users of the function tracer, we need to pass the ops struct to the ftrace_set_filter() functions. The functions ftrace_set_global_filter() and ftrace_set_global_notrace() is added to keep the old filter functions which are used to modify the generic function tracers. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c46
-rw-r--r--kernel/trace/trace_selftest.c4
2 files changed, 46 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 5b3ee04e39d9..d017c2c82c44 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2826,6 +2826,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
2826 struct ftrace_hash *hash; 2826 struct ftrace_hash *hash;
2827 int ret; 2827 int ret;
2828 2828
2829 /* All global ops uses the global ops filters */
2830 if (ops->flags & FTRACE_OPS_FL_GLOBAL)
2831 ops = &global_ops;
2832
2829 if (unlikely(ftrace_disabled)) 2833 if (unlikely(ftrace_disabled))
2830 return -ENODEV; 2834 return -ENODEV;
2831 2835
@@ -2856,6 +2860,41 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
2856 2860
2857/** 2861/**
2858 * ftrace_set_filter - set a function to filter on in ftrace 2862 * ftrace_set_filter - set a function to filter on in ftrace
2863 * @ops - the ops to set the filter with
2864 * @buf - the string that holds the function filter text.
2865 * @len - the length of the string.
2866 * @reset - non zero to reset all filters before applying this filter.
2867 *
2868 * Filters denote which functions should be enabled when tracing is enabled.
2869 * If @buf is NULL and reset is set, all functions will be enabled for tracing.
2870 */
2871void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
2872 int len, int reset)
2873{
2874 ftrace_set_regex(ops, buf, len, reset, 1);
2875}
2876EXPORT_SYMBOL_GPL(ftrace_set_filter);
2877
2878/**
2879 * ftrace_set_notrace - set a function to not trace in ftrace
2880 * @ops - the ops to set the notrace filter with
2881 * @buf - the string that holds the function notrace text.
2882 * @len - the length of the string.
2883 * @reset - non zero to reset all filters before applying this filter.
2884 *
2885 * Notrace Filters denote which functions should not be enabled when tracing
2886 * is enabled. If @buf is NULL and reset is set, all functions will be enabled
2887 * for tracing.
2888 */
2889void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
2890 int len, int reset)
2891{
2892 ftrace_set_regex(ops, buf, len, reset, 0);
2893}
2894EXPORT_SYMBOL_GPL(ftrace_set_notrace);
2895/**
2896 * ftrace_set_filter - set a function to filter on in ftrace
2897 * @ops - the ops to set the filter with
2859 * @buf - the string that holds the function filter text. 2898 * @buf - the string that holds the function filter text.
2860 * @len - the length of the string. 2899 * @len - the length of the string.
2861 * @reset - non zero to reset all filters before applying this filter. 2900 * @reset - non zero to reset all filters before applying this filter.
@@ -2863,13 +2902,15 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
2863 * Filters denote which functions should be enabled when tracing is enabled. 2902 * Filters denote which functions should be enabled when tracing is enabled.
2864 * If @buf is NULL and reset is set, all functions will be enabled for tracing. 2903 * If @buf is NULL and reset is set, all functions will be enabled for tracing.
2865 */ 2904 */
2866void ftrace_set_filter(unsigned char *buf, int len, int reset) 2905void ftrace_set_global_filter(unsigned char *buf, int len, int reset)
2867{ 2906{
2868 ftrace_set_regex(&global_ops, buf, len, reset, 1); 2907 ftrace_set_regex(&global_ops, buf, len, reset, 1);
2869} 2908}
2909EXPORT_SYMBOL_GPL(ftrace_set_global_filter);
2870 2910
2871/** 2911/**
2872 * ftrace_set_notrace - set a function to not trace in ftrace 2912 * ftrace_set_notrace - set a function to not trace in ftrace
2913 * @ops - the ops to set the notrace filter with
2873 * @buf - the string that holds the function notrace text. 2914 * @buf - the string that holds the function notrace text.
2874 * @len - the length of the string. 2915 * @len - the length of the string.
2875 * @reset - non zero to reset all filters before applying this filter. 2916 * @reset - non zero to reset all filters before applying this filter.
@@ -2878,10 +2919,11 @@ void ftrace_set_filter(unsigned char *buf, int len, int reset)
2878 * is enabled. If @buf is NULL and reset is set, all functions will be enabled 2919 * is enabled. If @buf is NULL and reset is set, all functions will be enabled
2879 * for tracing. 2920 * for tracing.
2880 */ 2921 */
2881void ftrace_set_notrace(unsigned char *buf, int len, int reset) 2922void ftrace_set_global_notrace(unsigned char *buf, int len, int reset)
2882{ 2923{
2883 ftrace_set_regex(&global_ops, buf, len, reset, 0); 2924 ftrace_set_regex(&global_ops, buf, len, reset, 0);
2884} 2925}
2926EXPORT_SYMBOL_GPL(ftrace_set_global_notrace);
2885 2927
2886/* 2928/*
2887 * command line interface to allow users to set filters on boot up. 2929 * command line interface to allow users to set filters on boot up.
diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c
index 659732eba07c..0fa2db305b7c 100644
--- a/kernel/trace/trace_selftest.c
+++ b/kernel/trace/trace_selftest.c
@@ -131,7 +131,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
131 func_name = "*" __stringify(DYN_FTRACE_TEST_NAME); 131 func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
132 132
133 /* filter only on our function */ 133 /* filter only on our function */
134 ftrace_set_filter(func_name, strlen(func_name), 1); 134 ftrace_set_global_filter(func_name, strlen(func_name), 1);
135 135
136 /* enable tracing */ 136 /* enable tracing */
137 ret = tracer_init(trace, tr); 137 ret = tracer_init(trace, tr);
@@ -181,7 +181,7 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
181 tracer_enabled = save_tracer_enabled; 181 tracer_enabled = save_tracer_enabled;
182 182
183 /* Enable tracing on all functions again */ 183 /* Enable tracing on all functions again */
184 ftrace_set_filter(NULL, 0, 1); 184 ftrace_set_global_filter(NULL, 0, 1);
185 185
186 return ret; 186 return ret;
187} 187}