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

Commit 72829bc3 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

ftrace: move enums to ftrace.h and make helper function global



picked from the mmiotracer patches to distangle the patch queues.

Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 86069782
Loading
Loading
Loading
Loading
+8 −16
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ unsigned long __read_mostly tracing_thresh;


static int tracing_disabled = 1;
static int tracing_disabled = 1;


static long
long
ns2usecs(cycle_t nsec)
ns2usecs(cycle_t nsec)
{
{
	nsec += 500;
	nsec += 500;
@@ -96,18 +96,6 @@ unsigned long nsecs_to_usecs(unsigned long nsecs)
	return nsecs / 1000;
	return nsecs / 1000;
}
}


enum trace_type {
	__TRACE_FIRST_TYPE = 0,

	TRACE_FN,
	TRACE_CTX,
	TRACE_WAKE,
	TRACE_STACK,
	TRACE_SPECIAL,

	__TRACE_LAST_TYPE
};

enum trace_flag_type {
enum trace_flag_type {
	TRACE_FLAG_IRQS_OFF		= 0x01,
	TRACE_FLAG_IRQS_OFF		= 0x01,
	TRACE_FLAG_NEED_RESCHED		= 0x02,
	TRACE_FLAG_NEED_RESCHED		= 0x02,
@@ -190,7 +178,7 @@ void *head_page(struct trace_array_cpu *data)
	return page_address(page);
	return page_address(page);
}
}


static int
int
trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
{
{
	int len = (PAGE_SIZE - 1) - s->len;
	int len = (PAGE_SIZE - 1) - s->len;
@@ -205,7 +193,7 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
	va_end(ap);
	va_end(ap);


	/* If we can't write it all, don't bother writing anything */
	/* If we can't write it all, don't bother writing anything */
	if (ret > len)
	if (ret >= len)
		return 0;
		return 0;


	s->len += ret;
	s->len += ret;
@@ -638,7 +626,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags)
	pc = preempt_count();
	pc = preempt_count();


	entry->preempt_count	= pc & 0xff;
	entry->preempt_count	= pc & 0xff;
	entry->pid		= tsk->pid;
	entry->pid		= (tsk) ? tsk->pid : 0;
	entry->t		= ftrace_now(raw_smp_processor_id());
	entry->t		= ftrace_now(raw_smp_processor_id());
	entry->flags = (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
	entry->flags = (irqs_disabled_flags(flags) ? TRACE_FLAG_IRQS_OFF : 0) |
		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
		((pc & HARDIRQ_MASK) ? TRACE_FLAG_HARDIRQ : 0) |
@@ -1541,6 +1529,9 @@ static int trace_empty(struct trace_iterator *iter)


static int print_trace_line(struct trace_iterator *iter)
static int print_trace_line(struct trace_iterator *iter)
{
{
	if (iter->trace && iter->trace->print_line)
		return iter->trace->print_line(iter);

	if (trace_flags & TRACE_ITER_BIN)
	if (trace_flags & TRACE_ITER_BIN)
		return print_bin_fmt(iter);
		return print_bin_fmt(iter);


@@ -2162,6 +2153,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
		return -ENOMEM;
		return -ENOMEM;


	iter->tr = &global_trace;
	iter->tr = &global_trace;
	iter->trace = current_trace;


	filp->private_data = iter;
	filp->private_data = iter;


+15 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,18 @@
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/clocksource.h>
#include <linux/clocksource.h>


enum trace_type {
	__TRACE_FIRST_TYPE = 0,

	TRACE_FN,
	TRACE_CTX,
	TRACE_WAKE,
	TRACE_STACK,
	TRACE_SPECIAL,

	__TRACE_LAST_TYPE
};

/*
/*
 * Function trace entry - function address and parent function addres:
 * Function trace entry - function address and parent function addres:
 */
 */
@@ -130,6 +142,7 @@ struct tracer {
	int			(*selftest)(struct tracer *trace,
	int			(*selftest)(struct tracer *trace,
					    struct trace_array *tr);
					    struct trace_array *tr);
#endif
#endif
	int			(*print_line)(struct trace_iterator *iter);
	struct tracer		*next;
	struct tracer		*next;
	int			print_max;
	int			print_max;
};
};
@@ -276,6 +289,8 @@ extern int trace_selftest_startup_sched_switch(struct tracer *trace,
#endif /* CONFIG_FTRACE_STARTUP_TEST */
#endif /* CONFIG_FTRACE_STARTUP_TEST */


extern void *head_page(struct trace_array_cpu *data);
extern void *head_page(struct trace_array_cpu *data);
extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...);
extern long ns2usecs(cycle_t nsec);


extern unsigned long trace_flags;
extern unsigned long trace_flags;