mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 22:21:42 +00:00
ftrace: fix up cmdline recording
The new work with converting the trace hooks over to markers broke the command line recording of ftrace. This patch fixes it again. Signed-off-by: Steven Rostedt <srostedt@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
41c52c0db9
commit
41bc8144d0
@ -652,9 +652,6 @@ static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN];
|
|||||||
static int cmdline_idx;
|
static int cmdline_idx;
|
||||||
static DEFINE_SPINLOCK(trace_cmdline_lock);
|
static DEFINE_SPINLOCK(trace_cmdline_lock);
|
||||||
|
|
||||||
/* trace in all context switches */
|
|
||||||
atomic_t trace_record_cmdline_enabled __read_mostly;
|
|
||||||
|
|
||||||
/* temporary disable recording */
|
/* temporary disable recording */
|
||||||
atomic_t trace_record_cmdline_disabled __read_mostly;
|
atomic_t trace_record_cmdline_disabled __read_mostly;
|
||||||
|
|
||||||
|
@ -218,6 +218,8 @@ void trace_function(struct trace_array *tr,
|
|||||||
|
|
||||||
void tracing_start_function_trace(void);
|
void tracing_start_function_trace(void);
|
||||||
void tracing_stop_function_trace(void);
|
void tracing_stop_function_trace(void);
|
||||||
|
void tracing_start_cmdline_record(void);
|
||||||
|
void tracing_stop_cmdline_record(void);
|
||||||
int register_tracer(struct tracer *type);
|
int register_tracer(struct tracer *type);
|
||||||
void unregister_tracer(struct tracer *type);
|
void unregister_tracer(struct tracer *type);
|
||||||
|
|
||||||
@ -226,8 +228,6 @@ extern unsigned long nsecs_to_usecs(unsigned long nsecs);
|
|||||||
extern unsigned long tracing_max_latency;
|
extern unsigned long tracing_max_latency;
|
||||||
extern unsigned long tracing_thresh;
|
extern unsigned long tracing_thresh;
|
||||||
|
|
||||||
extern atomic_t trace_record_cmdline_enabled;
|
|
||||||
|
|
||||||
void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
|
void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
|
||||||
void update_max_tr_single(struct trace_array *tr,
|
void update_max_tr_single(struct trace_array *tr,
|
||||||
struct task_struct *tsk, int cpu);
|
struct task_struct *tsk, int cpu);
|
||||||
|
@ -29,14 +29,14 @@ static void function_reset(struct trace_array *tr)
|
|||||||
static void start_function_trace(struct trace_array *tr)
|
static void start_function_trace(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
function_reset(tr);
|
function_reset(tr);
|
||||||
atomic_inc(&trace_record_cmdline_enabled);
|
tracing_start_cmdline_record();
|
||||||
tracing_start_function_trace();
|
tracing_start_function_trace();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stop_function_trace(struct trace_array *tr)
|
static void stop_function_trace(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
tracing_stop_function_trace();
|
tracing_stop_function_trace();
|
||||||
atomic_dec(&trace_record_cmdline_enabled);
|
tracing_stop_cmdline_record();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void function_trace_init(struct trace_array *tr)
|
static void function_trace_init(struct trace_array *tr)
|
||||||
|
@ -29,6 +29,9 @@ sched_switch_func(void *private, void *__rq, struct task_struct *prev,
|
|||||||
long disabled;
|
long disabled;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
|
tracing_record_cmdline(prev);
|
||||||
|
tracing_record_cmdline(next);
|
||||||
|
|
||||||
if (!tracer_enabled)
|
if (!tracer_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -63,8 +66,6 @@ sched_switch_callback(void *probe_data, void *call_data,
|
|||||||
prev = va_arg(*args, typeof(prev));
|
prev = va_arg(*args, typeof(prev));
|
||||||
next = va_arg(*args, typeof(next));
|
next = va_arg(*args, typeof(next));
|
||||||
|
|
||||||
tracing_record_cmdline(prev);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If tracer_switch_func only points to the local
|
* If tracer_switch_func only points to the local
|
||||||
* switch func, it still needs the ptr passed to it.
|
* switch func, it still needs the ptr passed to it.
|
||||||
@ -213,18 +214,26 @@ void tracing_stop_sched_switch(void)
|
|||||||
tracing_sched_unregister();
|
tracing_sched_unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tracing_start_cmdline_record(void)
|
||||||
|
{
|
||||||
|
tracing_start_sched_switch();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tracing_stop_cmdline_record(void)
|
||||||
|
{
|
||||||
|
tracing_stop_sched_switch();
|
||||||
|
}
|
||||||
|
|
||||||
static void start_sched_trace(struct trace_array *tr)
|
static void start_sched_trace(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
sched_switch_reset(tr);
|
sched_switch_reset(tr);
|
||||||
atomic_inc(&trace_record_cmdline_enabled);
|
|
||||||
tracer_enabled = 1;
|
tracer_enabled = 1;
|
||||||
tracing_start_sched_switch();
|
tracing_start_cmdline_record();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stop_sched_trace(struct trace_array *tr)
|
static void stop_sched_trace(struct trace_array *tr)
|
||||||
{
|
{
|
||||||
tracing_stop_sched_switch();
|
tracing_stop_cmdline_record();
|
||||||
atomic_dec(&trace_record_cmdline_enabled);
|
|
||||||
tracer_enabled = 0;
|
tracer_enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user