mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-13 20:16:26 +00:00
d25e37d89d
Currently the tracepoint site will iterate a vector and issue indirect calls to however many handlers are registered (ie. the vector is long). Using static_call() it is possible to optimize this for the common case of only having a single handler registered. In this case the static_call() can directly call this handler. Otherwise, if the vector is longer than 1, call a function that iterates the whole vector like the current code. [peterz: updated to new interface] Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20200818135805.279421092@infradead.org
56 lines
1.1 KiB
C
56 lines
1.1 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 {
|
|
const char *name; /* Tracepoint name */
|
|
struct static_key key;
|
|
struct static_call_key *static_call_key;
|
|
void *static_call_tramp;
|
|
void *iterator;
|
|
int (*regfunc)(void);
|
|
void (*unregfunc)(void);
|
|
struct tracepoint_func __rcu *funcs;
|
|
};
|
|
|
|
#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);
|
|
|
|
#endif
|