summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--kernel/trace/ftrace.c17
2 files changed, 19 insertions, 0 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index b3d34d3e0e7e..d4a884db16a3 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -398,6 +398,7 @@ int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
398void ftrace_set_global_filter(unsigned char *buf, int len, int reset); 398void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
399void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); 399void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
400void ftrace_free_filter(struct ftrace_ops *ops); 400void ftrace_free_filter(struct ftrace_ops *ops);
401void ftrace_ops_set_global_filter(struct ftrace_ops *ops);
401 402
402int register_ftrace_command(struct ftrace_func_command *cmd); 403int register_ftrace_command(struct ftrace_func_command *cmd);
403int unregister_ftrace_command(struct ftrace_func_command *cmd); 404int unregister_ftrace_command(struct ftrace_func_command *cmd);
@@ -645,6 +646,7 @@ static inline unsigned long ftrace_location(unsigned long ip)
645#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; }) 646#define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
646#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; }) 647#define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
647#define ftrace_free_filter(ops) do { } while (0) 648#define ftrace_free_filter(ops) do { } while (0)
649#define ftrace_ops_set_global_filter(ops) do { } while (0)
648 650
649static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf, 651static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
650 size_t cnt, loff_t *ppos) { return -ENODEV; } 652 size_t cnt, loff_t *ppos) { return -ENODEV; }
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 2050a7652a86..89d46e1c9302 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4239,6 +4239,23 @@ int ftrace_set_filter_ip(struct ftrace_ops *ops, unsigned long ip,
4239} 4239}
4240EXPORT_SYMBOL_GPL(ftrace_set_filter_ip); 4240EXPORT_SYMBOL_GPL(ftrace_set_filter_ip);
4241 4241
4242/**
4243 * ftrace_ops_set_global_filter - setup ops to use global filters
4244 * @ops - the ops which will use the global filters
4245 *
4246 * ftrace users who need global function trace filtering should call this.
4247 * It can set the global filter only if ops were not initialized before.
4248 */
4249void ftrace_ops_set_global_filter(struct ftrace_ops *ops)
4250{
4251 if (ops->flags & FTRACE_OPS_FL_INITIALIZED)
4252 return;
4253
4254 ftrace_ops_init(ops);
4255 ops->func_hash = &global_ops.local_hash;
4256}
4257EXPORT_SYMBOL_GPL(ftrace_ops_set_global_filter);
4258
4242static int 4259static int
4243ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, 4260ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
4244 int reset, int enable) 4261 int reset, int enable)