aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 063a92bad578..489da8b19f30 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -235,13 +235,33 @@ void trace_array_put(struct trace_array *this_tr)
235 mutex_unlock(&trace_types_lock); 235 mutex_unlock(&trace_types_lock);
236} 236}
237 237
238int filter_current_check_discard(struct ring_buffer *buffer, 238int filter_check_discard(struct ftrace_event_file *file, void *rec,
239 struct ftrace_event_call *call, void *rec, 239 struct ring_buffer *buffer,
240 struct ring_buffer_event *event) 240 struct ring_buffer_event *event)
241{ 241{
242 return filter_check_discard(call, rec, buffer, event); 242 if (unlikely(file->flags & FTRACE_EVENT_FL_FILTERED) &&
243 !filter_match_preds(file->filter, rec)) {
244 ring_buffer_discard_commit(buffer, event);
245 return 1;
246 }
247
248 return 0;
249}
250EXPORT_SYMBOL_GPL(filter_check_discard);
251
252int call_filter_check_discard(struct ftrace_event_call *call, void *rec,
253 struct ring_buffer *buffer,
254 struct ring_buffer_event *event)
255{
256 if (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&
257 !filter_match_preds(call->filter, rec)) {
258 ring_buffer_discard_commit(buffer, event);
259 return 1;
260 }
261
262 return 0;
243} 263}
244EXPORT_SYMBOL_GPL(filter_current_check_discard); 264EXPORT_SYMBOL_GPL(call_filter_check_discard);
245 265
246cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu) 266cycle_t buffer_ftrace_now(struct trace_buffer *buf, int cpu)
247{ 267{
@@ -1633,7 +1653,7 @@ trace_function(struct trace_array *tr,
1633 entry->ip = ip; 1653 entry->ip = ip;
1634 entry->parent_ip = parent_ip; 1654 entry->parent_ip = parent_ip;
1635 1655
1636 if (!filter_check_discard(call, entry, buffer, event)) 1656 if (!call_filter_check_discard(call, entry, buffer, event))
1637 __buffer_unlock_commit(buffer, event); 1657 __buffer_unlock_commit(buffer, event);
1638} 1658}
1639 1659
@@ -1717,7 +1737,7 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
1717 1737
1718 entry->size = trace.nr_entries; 1738 entry->size = trace.nr_entries;
1719 1739
1720 if (!filter_check_discard(call, entry, buffer, event)) 1740 if (!call_filter_check_discard(call, entry, buffer, event))
1721 __buffer_unlock_commit(buffer, event); 1741 __buffer_unlock_commit(buffer, event);
1722 1742
1723 out: 1743 out:
@@ -1819,7 +1839,7 @@ ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
1819 trace.entries = entry->caller; 1839 trace.entries = entry->caller;
1820 1840
1821 save_stack_trace_user(&trace); 1841 save_stack_trace_user(&trace);
1822 if (!filter_check_discard(call, entry, buffer, event)) 1842 if (!call_filter_check_discard(call, entry, buffer, event))
1823 __buffer_unlock_commit(buffer, event); 1843 __buffer_unlock_commit(buffer, event);
1824 1844
1825 out_drop_count: 1845 out_drop_count:
@@ -2011,7 +2031,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
2011 entry->fmt = fmt; 2031 entry->fmt = fmt;
2012 2032
2013 memcpy(entry->buf, tbuffer, sizeof(u32) * len); 2033 memcpy(entry->buf, tbuffer, sizeof(u32) * len);
2014 if (!filter_check_discard(call, entry, buffer, event)) { 2034 if (!call_filter_check_discard(call, entry, buffer, event)) {
2015 __buffer_unlock_commit(buffer, event); 2035 __buffer_unlock_commit(buffer, event);
2016 ftrace_trace_stack(buffer, flags, 6, pc); 2036 ftrace_trace_stack(buffer, flags, 6, pc);
2017 } 2037 }
@@ -2066,7 +2086,7 @@ __trace_array_vprintk(struct ring_buffer *buffer,
2066 2086
2067 memcpy(&entry->buf, tbuffer, len); 2087 memcpy(&entry->buf, tbuffer, len);
2068 entry->buf[len] = '\0'; 2088 entry->buf[len] = '\0';
2069 if (!filter_check_discard(call, entry, buffer, event)) { 2089 if (!call_filter_check_discard(call, entry, buffer, event)) {
2070 __buffer_unlock_commit(buffer, event); 2090 __buffer_unlock_commit(buffer, event);
2071 ftrace_trace_stack(buffer, flags, 6, pc); 2091 ftrace_trace_stack(buffer, flags, 6, pc);
2072 } 2092 }