Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bacff50 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "tracing: Add CONFIG_KPROBES_DEBUG config"

parents e35b5d58 d0f6d49a
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -442,6 +442,44 @@ enum event_trigger_type {
	ETT_HIST_ENABLE		= (1 << 5),
};

#ifdef CONFIG_KPROBES_DEBUG
struct dyn_event_operations;

/**
 * struct dyn_event - Dynamic event list header
 *
 * The dyn_event structure encapsulates a list and a pointer to the operators
 * for making a global list of dynamic events.
 * User must includes this in each event structure, so that those events can
 * be added/removed via dynamic_events interface.
 */
struct dyn_event {
	struct list_head		list;
	struct dyn_event_operations	*ops;
};

struct synth_field {
	char *type;
	char *name;
	size_t size;
	bool is_signed;
	bool is_string;
};

struct synth_event {
	struct dyn_event			devent;
	int					ref;
	char					*name;
	struct synth_field			**fields;
	unsigned int				n_fields;
	unsigned int				n_u64;
	struct trace_event_class		class;
	struct trace_event_call			call;
	struct tracepoint			*tp;
};
extern struct synth_event *find_synth_event(const char *name);
#endif

extern int filter_match_preds(struct event_filter *filter, void *rec);

extern enum event_trigger_type
+12 −0
Original line number Diff line number Diff line
@@ -533,6 +533,18 @@ config KPROBE_EVENTS_ON_NOTRACE

	  If unsure, say N.

config KPROBES_DEBUG
	bool "support bug on kprobe events"
	depends on KPROBE_EVENTS
	select HIST_TRIGGERS
	default n
	help
	  This exports the required function and structures to
	  allow the kprobe module to search for and use synthetic
	  events which will aid in debugging.

	  If unsure, say N.

config UPROBE_EVENTS
	bool "Enable uprobes-based dynamic events"
	depends on ARCH_SUPPORTS_UPROBES
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#ifdef CONFIG_KPROBES_DEBUG
#include <linux/trace_events.h>
#endif

#include "trace.h"

@@ -50,6 +53,7 @@ struct dyn_event_operations {
/* Register new dyn_event type -- must be called at first */
int dyn_event_register(struct dyn_event_operations *ops);

#ifndef CONFIG_KPROBES_DEBUG
/**
 * struct dyn_event - Dynamic event list header
 *
@@ -62,6 +66,7 @@ struct dyn_event {
	struct list_head		list;
	struct dyn_event_operations	*ops;
};
#endif

extern struct list_head dyn_event_list;

+9 −0
Original line number Diff line number Diff line
@@ -390,6 +390,7 @@ static struct dyn_event_operations synth_event_ops = {
	.match = synth_event_match,
};

#ifndef CONFIG_KPROBES_DEBUG
struct synth_field {
	char *type;
	char *name;
@@ -409,6 +410,7 @@ struct synth_event {
	struct trace_event_call			call;
	struct tracepoint			*tp;
};
#endif

static bool is_synth_event(struct dyn_event *ev)
{
@@ -1170,7 +1172,11 @@ static inline void trace_synth(struct synth_event *event, u64 *var_ref_vals,
	}
}

#ifdef CONFIG_KPROBES_DEBUG
struct synth_event *find_synth_event(const char *name)
#else
static struct synth_event *find_synth_event(const char *name)
#endif
{
	struct dyn_event *pos;
	struct synth_event *event;
@@ -1185,6 +1191,9 @@ static struct synth_event *find_synth_event(const char *name)

	return NULL;
}
#ifdef CONFIG_KPROBES_DEBUG
EXPORT_SYMBOL(find_synth_event);
#endif

static int register_synth_event(struct synth_event *event)
{