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

Commit 213cc060 authored by Pekka J Enberg's avatar Pekka J Enberg Committed by Ingo Molnar
Browse files

ftrace: introduce tracing_reset_online_cpus() helper



Impact: cleanup

This patch factors out common code from multiple tracers into a
tracing_reset_online_cpus() function and converts the tracers to use it.

Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 30cd324e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -679,6 +679,16 @@ void tracing_reset(struct trace_array *tr, int cpu)
	ftrace_enable_cpu();
}

void tracing_reset_online_cpus(struct trace_array *tr)
{
	int cpu;

	tr->time_start = ftrace_now(tr->cpu);

	for_each_online_cpu(cpu)
		tracing_reset(tr, cpu);
}

#define SAVED_CMDLINES 128
static unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1];
static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
+1 −0
Original line number Diff line number Diff line
@@ -374,6 +374,7 @@ struct trace_iterator {
int tracing_is_enabled(void);
void trace_wake_up(void);
void tracing_reset(struct trace_array *tr, int cpu);
void tracing_reset_online_cpus(struct trace_array *tr);
int tracing_open_generic(struct inode *inode, struct file *filp);
struct dentry *tracing_init_dentry(void);
void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
+1 −11
Original line number Diff line number Diff line
@@ -37,16 +37,6 @@ void disable_boot_trace(void)
		tracing_stop_sched_switch_record();
}

static void reset_boot_trace(struct trace_array *tr)
{
	int cpu;

	tr->time_start = ftrace_now(tr->cpu);

	for_each_online_cpu(cpu)
		tracing_reset(tr, cpu);
}

static int boot_trace_init(struct trace_array *tr)
{
	int cpu;
@@ -130,7 +120,7 @@ struct tracer boot_tracer __read_mostly =
{
	.name		= "initcall",
	.init		= boot_trace_init,
	.reset		= reset_boot_trace,
	.reset		= tracing_reset_online_cpus,
	.print_line	= initcall_print_line,
};

+2 −12
Original line number Diff line number Diff line
@@ -16,20 +16,10 @@

#include "trace.h"

static void function_reset(struct trace_array *tr)
{
	int cpu;

	tr->time_start = ftrace_now(tr->cpu);

	for_each_online_cpu(cpu)
		tracing_reset(tr, cpu);
}

static void start_function_trace(struct trace_array *tr)
{
	tr->cpu = get_cpu();
	function_reset(tr);
	tracing_reset_online_cpus(tr);
	put_cpu();

	tracing_start_cmdline_record();
@@ -55,7 +45,7 @@ static void function_trace_reset(struct trace_array *tr)

static void function_trace_start(struct trace_array *tr)
{
	function_reset(tr);
	tracing_reset_online_cpus(tr);
}

static struct tracer function_trace __read_mostly =
+2 −12
Original line number Diff line number Diff line
@@ -25,16 +25,6 @@ static DEFINE_PER_CPU(unsigned char[SIZEOF_BTS], buffer);
#define this_buffer per_cpu(buffer, smp_processor_id())


static void bts_trace_reset(struct trace_array *tr)
{
	int cpu;

	tr->time_start = ftrace_now(tr->cpu);

	for_each_online_cpu(cpu)
		tracing_reset(tr, cpu);
}

static void bts_trace_start_cpu(void *arg)
{
	if (this_tracer)
@@ -54,7 +44,7 @@ static void bts_trace_start(struct trace_array *tr)
{
	int cpu;

	bts_trace_reset(tr);
	tracing_reset_online_cpus(tr);

	for_each_cpu_mask(cpu, cpu_possible_map)
		smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1);
@@ -78,7 +68,7 @@ static void bts_trace_stop(struct trace_array *tr)

static int bts_trace_init(struct trace_array *tr)
{
	bts_trace_reset(tr);
	tracing_reset_online_cpus(tr);
	bts_trace_start(tr);

	return 0;
Loading