This patch fixes some bugs to the updating of the max trace that
was caused by implementing the new buffering.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
memcpy(max_tr.data[i], data, sizeof(*data));
data->trace = save_trace;
data->trace_pages = save_pages;
memcpy(max_tr.data[i], data, sizeof(*data));
data->trace = save_trace;
data->trace_pages = save_pages;
}
__update_max_tr(tr, tsk, cpu);
}
__update_max_tr(tr, tsk, cpu);
memcpy(max_tr.data[cpu], data, sizeof(*data));
data->trace = save_trace;
data->trace_pages = save_pages;
memcpy(max_tr.data[cpu], data, sizeof(*data));
data->trace = save_trace;
data->trace_pages = save_pages;
__update_max_tr(tr, tsk, cpu);
spin_unlock(&ftrace_max_lock);
__update_max_tr(tr, tsk, cpu);
spin_unlock(&ftrace_max_lock);
entry->ctx.next_prio,
comm);
break;
entry->ctx.next_prio,
comm);
break;
+ default:
+ seq_printf(m, "Unknown type %d\n", entry->type);
* round up a bit.
*/
global_trace.entries = ENTRIES_PER_PAGE;
* round up a bit.
*/
global_trace.entries = ENTRIES_PER_PAGE;
- max_tr.entries = global_trace.entries;
pages++;
while (global_trace.entries < trace_nr_entries) {
pages++;
while (global_trace.entries < trace_nr_entries) {
+ max_tr.entries = global_trace.entries;
pr_info("tracer: %d pages allocated for %ld",
pages, trace_nr_entries);
pr_info("tracer: %d pages allocated for %ld",
pages, trace_nr_entries);
static DEFINE_PER_CPU(int, tracing_cpu);
static DEFINE_PER_CPU(int, tracing_cpu);
+static DEFINE_SPINLOCK(max_trace_lock);
+
enum {
TRACER_IRQS_OFF = (1 << 1),
TRACER_PREEMPT_OFF = (1 << 2),
enum {
TRACER_IRQS_OFF = (1 << 1),
TRACER_PREEMPT_OFF = (1 << 2),
int cpu)
{
unsigned long latency, t0, t1;
int cpu)
{
unsigned long latency, t0, t1;
- cycle_t T0, T1, T2, delta;
if (!report_latency(delta))
goto out;
if (!report_latency(delta))
goto out;
- ftrace(tr, data, CALLER_ADDR0, parent_ip, flags);
- /*
- * Update the timestamp, because the trace entry above
- * might change it (it can only get larger so the latency
- * is fair to be reported):
- */
- T2 = now(cpu);
+ spin_lock(&max_trace_lock);
+ /* check if we are still the max latency */
+ if (!report_latency(delta))
+ goto out_unlock;
+
+ ftrace(tr, data, CALLER_ADDR0, parent_ip, flags);
latency = nsecs_to_usecs(delta);
if (data->critical_sequence != max_sequence)
latency = nsecs_to_usecs(delta);
if (data->critical_sequence != max_sequence)
tracing_max_latency = delta;
t0 = nsecs_to_usecs(T0);
tracing_max_latency = delta;
t0 = nsecs_to_usecs(T0);
+out_unlock:
+ spin_unlock(&max_trace_lock);
+
out:
data->critical_sequence = max_sequence;
data->preempt_timestamp = now(cpu);
out:
data->critical_sequence = max_sequence;
data->preempt_timestamp = now(cpu);
static void start_irqsoff_tracer(struct trace_array *tr)
{
static void start_irqsoff_tracer(struct trace_array *tr)
{
register_ftrace_function(&trace_ops);
register_ftrace_function(&trace_ops);
}
static void stop_irqsoff_tracer(struct trace_array *tr)
{
}
static void stop_irqsoff_tracer(struct trace_array *tr)
{
- unregister_ftrace_function(&trace_ops);
+ unregister_ftrace_function(&trace_ops);
}
static void __irqsoff_tracer_init(struct trace_array *tr)
}
static void __irqsoff_tracer_init(struct trace_array *tr)