trace.c (8ab7a2b7055c88c3da5e4684dfa015c6a8987c28) trace.c (458999c6f67b0ffcc704a4892041dd700adf7d83)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * ring buffer based function tracer
4 *
5 * Copyright (C) 2007-2012 Steven Rostedt <srostedt@redhat.com>
6 * Copyright (C) 2008 Ingo Molnar <mingo@redhat.com>
7 *
8 * Originally taken from the RT patch by:

--- 257 unchanged lines hidden (view full) ---

266}
267
268static DEFINE_MUTEX(ftrace_export_lock);
269
270static struct trace_export __rcu *ftrace_exports_list __read_mostly;
271
272static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled);
273static DEFINE_STATIC_KEY_FALSE(trace_event_exports_enabled);
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * ring buffer based function tracer
4 *
5 * Copyright (C) 2007-2012 Steven Rostedt <srostedt@redhat.com>
6 * Copyright (C) 2008 Ingo Molnar <mingo@redhat.com>
7 *
8 * Originally taken from the RT patch by:

--- 257 unchanged lines hidden (view full) ---

266}
267
268static DEFINE_MUTEX(ftrace_export_lock);
269
270static struct trace_export __rcu *ftrace_exports_list __read_mostly;
271
272static DEFINE_STATIC_KEY_FALSE(trace_function_exports_enabled);
273static DEFINE_STATIC_KEY_FALSE(trace_event_exports_enabled);
274static DEFINE_STATIC_KEY_FALSE(trace_marker_exports_enabled);
274
275static inline void ftrace_exports_enable(struct trace_export *export)
276{
277 if (export->flags & TRACE_EXPORT_FUNCTION)
278 static_branch_inc(&trace_function_exports_enabled);
279
280 if (export->flags & TRACE_EXPORT_EVENT)
281 static_branch_inc(&trace_event_exports_enabled);
275
276static inline void ftrace_exports_enable(struct trace_export *export)
277{
278 if (export->flags & TRACE_EXPORT_FUNCTION)
279 static_branch_inc(&trace_function_exports_enabled);
280
281 if (export->flags & TRACE_EXPORT_EVENT)
282 static_branch_inc(&trace_event_exports_enabled);
283
284 if (export->flags & TRACE_EXPORT_MARKER)
285 static_branch_inc(&trace_marker_exports_enabled);
282}
283
284static inline void ftrace_exports_disable(struct trace_export *export)
285{
286 if (export->flags & TRACE_EXPORT_FUNCTION)
287 static_branch_dec(&trace_function_exports_enabled);
288
289 if (export->flags & TRACE_EXPORT_EVENT)
290 static_branch_dec(&trace_event_exports_enabled);
286}
287
288static inline void ftrace_exports_disable(struct trace_export *export)
289{
290 if (export->flags & TRACE_EXPORT_FUNCTION)
291 static_branch_dec(&trace_function_exports_enabled);
292
293 if (export->flags & TRACE_EXPORT_EVENT)
294 static_branch_dec(&trace_event_exports_enabled);
295
296 if (export->flags & TRACE_EXPORT_MARKER)
297 static_branch_dec(&trace_marker_exports_enabled);
291}
292
293static void ftrace_exports(struct ring_buffer_event *event, int flag)
294{
295 struct trace_export *export;
296
297 preempt_disable_notrace();
298

--- 6383 unchanged lines hidden (view full) ---

6682 }
6683
6684 if (entry->buf[cnt - 1] != '\n') {
6685 entry->buf[cnt] = '\n';
6686 entry->buf[cnt + 1] = '\0';
6687 } else
6688 entry->buf[cnt] = '\0';
6689
298}
299
300static void ftrace_exports(struct ring_buffer_event *event, int flag)
301{
302 struct trace_export *export;
303
304 preempt_disable_notrace();
305

--- 6383 unchanged lines hidden (view full) ---

6689 }
6690
6691 if (entry->buf[cnt - 1] != '\n') {
6692 entry->buf[cnt] = '\n';
6693 entry->buf[cnt + 1] = '\0';
6694 } else
6695 entry->buf[cnt] = '\0';
6696
6697 if (static_branch_unlikely(&trace_marker_exports_enabled))
6698 ftrace_exports(event, TRACE_EXPORT_MARKER);
6690 __buffer_unlock_commit(buffer, event);
6691
6692 if (tt)
6693 event_triggers_post_call(tr->trace_marker_file, tt);
6694
6695 if (written > 0)
6696 *fpos += written;
6697

--- 2926 unchanged lines hidden ---
6699 __buffer_unlock_commit(buffer, event);
6700
6701 if (tt)
6702 event_triggers_post_call(tr->trace_marker_file, tt);
6703
6704 if (written > 0)
6705 *fpos += written;
6706

--- 2926 unchanged lines hidden ---