mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
654ced4a13
Introduce a "faultable" flag within the extended structure to know whether a tracepoint needs rcu tasks trace grace period before reclaim. This can be queried using tracepoint_is_faultable(). Acked-by: Andrii Nakryiko <andrii@kernel.org> Tested-by: Jordan Rife <jrife@google.com> Cc: Michael Jeanson <mjeanson@efficios.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Yonghong Song <yhs@fb.com> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com> Cc: bpf@vger.kernel.org Cc: Joel Fernandes <joel@joelfernandes.org> Cc: Jordan Rife <jrife@google.com> Cc: linux-trace-kernel@vger.kernel.org Link: https://lore.kernel.org/20241031152056.744137-3-mathieu.desnoyers@efficios.com Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
98 lines
2.5 KiB
C
98 lines
2.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef TRACEPOINT_DEFS_H
|
|
#define TRACEPOINT_DEFS_H 1
|
|
|
|
/*
|
|
* File can be included directly by headers who only want to access
|
|
* tracepoint->key to guard out of line trace calls, or the definition of
|
|
* trace_print_flags{_u64}. Otherwise linux/tracepoint.h should be used.
|
|
*/
|
|
|
|
#include <linux/atomic.h>
|
|
#include <linux/static_key.h>
|
|
|
|
struct static_call_key;
|
|
|
|
struct trace_print_flags {
|
|
unsigned long mask;
|
|
const char *name;
|
|
};
|
|
|
|
struct trace_print_flags_u64 {
|
|
unsigned long long mask;
|
|
const char *name;
|
|
};
|
|
|
|
struct tracepoint_func {
|
|
void *func;
|
|
void *data;
|
|
int prio;
|
|
};
|
|
|
|
struct tracepoint_ext {
|
|
int (*regfunc)(void);
|
|
void (*unregfunc)(void);
|
|
/* Flags. */
|
|
unsigned int faultable:1;
|
|
};
|
|
|
|
struct tracepoint {
|
|
const char *name; /* Tracepoint name */
|
|
struct static_key_false key;
|
|
struct static_call_key *static_call_key;
|
|
void *static_call_tramp;
|
|
void *iterator;
|
|
void *probestub;
|
|
struct tracepoint_func __rcu *funcs;
|
|
struct tracepoint_ext *ext;
|
|
};
|
|
|
|
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
|
|
typedef const int tracepoint_ptr_t;
|
|
#else
|
|
typedef struct tracepoint * const tracepoint_ptr_t;
|
|
#endif
|
|
|
|
struct bpf_raw_event_map {
|
|
struct tracepoint *tp;
|
|
void *bpf_func;
|
|
u32 num_args;
|
|
u32 writable_size;
|
|
} __aligned(32);
|
|
|
|
/*
|
|
* If a tracepoint needs to be called from a header file, it is not
|
|
* recommended to call it directly, as tracepoints in header files
|
|
* may cause side-effects and bloat the kernel. Instead, use
|
|
* tracepoint_enabled() to test if the tracepoint is enabled, then if
|
|
* it is, call a wrapper function defined in a C file that will then
|
|
* call the tracepoint.
|
|
*
|
|
* For "trace_foo_bar()", you would need to create a wrapper function
|
|
* in a C file to call trace_foo_bar():
|
|
* void do_trace_foo_bar(args) { trace_foo_bar(args); }
|
|
* Then in the header file, declare the tracepoint:
|
|
* DECLARE_TRACEPOINT(foo_bar);
|
|
* And call your wrapper:
|
|
* static inline void some_inlined_function() {
|
|
* [..]
|
|
* if (tracepoint_enabled(foo_bar))
|
|
* do_trace_foo_bar(args);
|
|
* [..]
|
|
* }
|
|
*
|
|
* Note: tracepoint_enabled(foo_bar) is equivalent to trace_foo_bar_enabled()
|
|
* but is safe to have in headers, where trace_foo_bar_enabled() is not.
|
|
*/
|
|
#define DECLARE_TRACEPOINT(tp) \
|
|
extern struct tracepoint __tracepoint_##tp
|
|
|
|
#ifdef CONFIG_TRACEPOINTS
|
|
# define tracepoint_enabled(tp) \
|
|
static_branch_unlikely(&(__tracepoint_##tp).key)
|
|
#else
|
|
# define tracepoint_enabled(tracepoint) false
|
|
#endif
|
|
|
|
#endif
|