Commit 02f2f764 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Allow irq/preempt tracers to be used by instances

The irqsoff, preemptoff and preemptirqsoff tracers can now be used by
instances. But they may only be used by one instance at a time (including
the top level directory). This allows multiple tracers to run while the
irqsoff (and friends) tracer is running simultaneously.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 65daaca7
...@@ -597,8 +597,13 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph) ...@@ -597,8 +597,13 @@ static void stop_irqsoff_tracer(struct trace_array *tr, int graph)
unregister_irqsoff_function(tr, graph); unregister_irqsoff_function(tr, graph);
} }
static void __irqsoff_tracer_init(struct trace_array *tr) static bool irqsoff_busy;
static int __irqsoff_tracer_init(struct trace_array *tr)
{ {
if (irqsoff_busy)
return -EBUSY;
save_flags = trace_flags; save_flags = trace_flags;
/* non overwrite screws up the latency tracers */ /* non overwrite screws up the latency tracers */
...@@ -617,6 +622,9 @@ static void __irqsoff_tracer_init(struct trace_array *tr) ...@@ -617,6 +622,9 @@ static void __irqsoff_tracer_init(struct trace_array *tr)
if (start_irqsoff_tracer(tr, (tr->flags & TRACE_ARRAY_FL_GLOBAL && if (start_irqsoff_tracer(tr, (tr->flags & TRACE_ARRAY_FL_GLOBAL &&
is_graph()))) is_graph())))
printk(KERN_ERR "failed to start irqsoff tracer\n"); printk(KERN_ERR "failed to start irqsoff tracer\n");
irqsoff_busy = true;
return 0;
} }
static void irqsoff_tracer_reset(struct trace_array *tr) static void irqsoff_tracer_reset(struct trace_array *tr)
...@@ -629,6 +637,8 @@ static void irqsoff_tracer_reset(struct trace_array *tr) ...@@ -629,6 +637,8 @@ static void irqsoff_tracer_reset(struct trace_array *tr)
set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, lat_flag); set_tracer_flag(tr, TRACE_ITER_LATENCY_FMT, lat_flag);
set_tracer_flag(tr, TRACE_ITER_OVERWRITE, overwrite_flag); set_tracer_flag(tr, TRACE_ITER_OVERWRITE, overwrite_flag);
ftrace_reset_array_ops(tr); ftrace_reset_array_ops(tr);
irqsoff_busy = false;
} }
static void irqsoff_tracer_start(struct trace_array *tr) static void irqsoff_tracer_start(struct trace_array *tr)
...@@ -646,8 +656,7 @@ static int irqsoff_tracer_init(struct trace_array *tr) ...@@ -646,8 +656,7 @@ static int irqsoff_tracer_init(struct trace_array *tr)
{ {
trace_type = TRACER_IRQS_OFF; trace_type = TRACER_IRQS_OFF;
__irqsoff_tracer_init(tr); return __irqsoff_tracer_init(tr);
return 0;
} }
static struct tracer irqsoff_tracer __read_mostly = static struct tracer irqsoff_tracer __read_mostly =
{ {
...@@ -667,6 +676,7 @@ static struct tracer irqsoff_tracer __read_mostly = ...@@ -667,6 +676,7 @@ static struct tracer irqsoff_tracer __read_mostly =
#endif #endif
.open = irqsoff_trace_open, .open = irqsoff_trace_open,
.close = irqsoff_trace_close, .close = irqsoff_trace_close,
.allow_instances = true,
.use_max_tr = true, .use_max_tr = true,
}; };
# define register_irqsoff(trace) register_tracer(&trace) # define register_irqsoff(trace) register_tracer(&trace)
...@@ -679,8 +689,7 @@ static int preemptoff_tracer_init(struct trace_array *tr) ...@@ -679,8 +689,7 @@ static int preemptoff_tracer_init(struct trace_array *tr)
{ {
trace_type = TRACER_PREEMPT_OFF; trace_type = TRACER_PREEMPT_OFF;
__irqsoff_tracer_init(tr); return __irqsoff_tracer_init(tr);
return 0;
} }
static struct tracer preemptoff_tracer __read_mostly = static struct tracer preemptoff_tracer __read_mostly =
...@@ -701,6 +710,7 @@ static struct tracer preemptoff_tracer __read_mostly = ...@@ -701,6 +710,7 @@ static struct tracer preemptoff_tracer __read_mostly =
#endif #endif
.open = irqsoff_trace_open, .open = irqsoff_trace_open,
.close = irqsoff_trace_close, .close = irqsoff_trace_close,
.allow_instances = true,
.use_max_tr = true, .use_max_tr = true,
}; };
# define register_preemptoff(trace) register_tracer(&trace) # define register_preemptoff(trace) register_tracer(&trace)
...@@ -715,8 +725,7 @@ static int preemptirqsoff_tracer_init(struct trace_array *tr) ...@@ -715,8 +725,7 @@ static int preemptirqsoff_tracer_init(struct trace_array *tr)
{ {
trace_type = TRACER_IRQS_OFF | TRACER_PREEMPT_OFF; trace_type = TRACER_IRQS_OFF | TRACER_PREEMPT_OFF;
__irqsoff_tracer_init(tr); return __irqsoff_tracer_init(tr);
return 0;
} }
static struct tracer preemptirqsoff_tracer __read_mostly = static struct tracer preemptirqsoff_tracer __read_mostly =
...@@ -737,6 +746,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly = ...@@ -737,6 +746,7 @@ static struct tracer preemptirqsoff_tracer __read_mostly =
#endif #endif
.open = irqsoff_trace_open, .open = irqsoff_trace_open,
.close = irqsoff_trace_close, .close = irqsoff_trace_close,
.allow_instances = true,
.use_max_tr = true, .use_max_tr = true,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment