#include <uapi/linux/sched/types.h>
#include <linux/stringify.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#include <linux/slab.h>
static inline int trace_valid_entry(struct trace_entry *entry)
{ … }
static int trace_test_buffer_cpu(struct array_buffer *buf, int cpu)
{ … }
static int __maybe_unused trace_test_buffer(struct array_buffer *buf, unsigned long *count)
{ … }
static inline void warn_failed_init_tracer(struct tracer *trace, int init_ret)
{ … }
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
static int trace_selftest_test_probe1_cnt;
static void trace_selftest_test_probe1_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static int trace_selftest_test_probe2_cnt;
static void trace_selftest_test_probe2_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static int trace_selftest_test_probe3_cnt;
static void trace_selftest_test_probe3_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static int trace_selftest_test_global_cnt;
static void trace_selftest_test_global_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static int trace_selftest_test_dyn_cnt;
static void trace_selftest_test_dyn_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static struct ftrace_ops test_probe1 = …;
static struct ftrace_ops test_probe2 = …;
static struct ftrace_ops test_probe3 = …;
static void print_counts(void)
{ … }
static void reset_counts(void)
{ … }
static int trace_selftest_ops(struct trace_array *tr, int cnt)
{ … }
static int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
struct trace_array *tr,
int (*func)(void))
{ … }
static int trace_selftest_recursion_cnt;
static void trace_selftest_test_recursion_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static void trace_selftest_test_recursion_safe_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static struct ftrace_ops test_rec_probe = …;
static struct ftrace_ops test_recsafe_probe = …;
static int
trace_selftest_function_recursion(void)
{ … }
#else
#define trace_selftest_startup_dynamic_tracing …
#define trace_selftest_function_recursion …
#endif
static enum { … } trace_selftest_regs_stat;
static void trace_selftest_test_regs_func(unsigned long ip,
unsigned long pip,
struct ftrace_ops *op,
struct ftrace_regs *fregs)
{ … }
static struct ftrace_ops test_regs_probe = …;
static int
trace_selftest_function_regs(void)
{ … }
__init int
trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
#define CHAR_NUMBER …
#define SHORT_NUMBER …
#define WORD_NUMBER …
#define LONG_NUMBER …
#define ERRSTR_BUFLEN …
struct fgraph_fixture { … };
static __init int store_entry(struct ftrace_graph_ent *trace,
struct fgraph_ops *gops)
{ … }
static __init void store_return(struct ftrace_graph_ret *trace,
struct fgraph_ops *gops)
{ … }
static int __init init_fgraph_fixture(struct fgraph_fixture *fixture)
{ … }
static int __init test_graph_storage_single(struct fgraph_fixture *fixture)
{ … }
static struct fgraph_fixture store_bytes[4] __initdata = …;
static __init int test_graph_storage_multi(void)
{ … }
static __init int test_graph_storage(void)
{ … }
#else
static inline int test_graph_storage(void) { return 0; }
#endif
#define GRAPH_MAX_FUNC_TEST …
static unsigned int graph_hang_thresh;
static int trace_graph_entry_watchdog(struct ftrace_graph_ent *trace,
struct fgraph_ops *gops)
{ … }
static struct fgraph_ops fgraph_ops __initdata = …;
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
static struct ftrace_ops direct;
#endif
__init int
trace_selftest_startup_function_graph(struct tracer *trace,
struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_IRQSOFF_TRACER
int
trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_PREEMPT_TRACER
int
trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#if defined(CONFIG_IRQSOFF_TRACER) && defined(CONFIG_PREEMPT_TRACER)
int
trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_NOP_TRACER
int
trace_selftest_startup_nop(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_SCHED_TRACER
struct wakeup_test_data { … };
static int trace_wakeup_test_thread(void *data)
{ … }
int
trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr)
{ … }
#endif
#ifdef CONFIG_BRANCH_TRACER
int
trace_selftest_startup_branch(struct tracer *trace, struct trace_array *tr)
{
unsigned long count;
int ret;
ret = tracer_init(trace, tr);
if (ret) {
warn_failed_init_tracer(trace, ret);
return ret;
}
msleep(100);
tracing_stop();
ret = trace_test_buffer(&tr->array_buffer, &count);
trace->reset(tr);
tracing_start();
if (!ret && !count) {
printk(KERN_CONT ".. no entries found ..");
ret = -1;
}
return ret;
}
#endif