Commit f6490438 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'tracing-fixes-for-linus' of...

Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, ds, bts: cleanup/fix DS configuration
  ring-buffer: reset timestamps when ring buffer is reset
  trace: set max latency variable to zero on default
  trace: stop all recording to ring buffer on ftrace_dump
  trace: print ftrace_dump at KERN_EMERG log level
  ring_buffer: reset write when reserve buffer fail
  tracing/function-graph-tracer: fix a regression while suspend to disk
  ring-buffer: fix alignment problem
parents e81cfd21 ba2607fe
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* - buffer allocation (memory accounting) * - buffer allocation (memory accounting)
* *
* *
* Copyright (C) 2007-2008 Intel Corporation. * Copyright (C) 2007-2009 Intel Corporation.
* Markus Metzger <markus.t.metzger@intel.com>, 2007-2008 * Markus Metzger <markus.t.metzger@intel.com>, 2007-2009
*/ */
...@@ -890,7 +890,7 @@ int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value) ...@@ -890,7 +890,7 @@ int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value)
} }
static const struct ds_configuration ds_cfg_netburst = { static const struct ds_configuration ds_cfg_netburst = {
.name = "netburst", .name = "Netburst",
.ctl[dsf_bts] = (1 << 2) | (1 << 3), .ctl[dsf_bts] = (1 << 2) | (1 << 3),
.ctl[dsf_bts_kernel] = (1 << 5), .ctl[dsf_bts_kernel] = (1 << 5),
.ctl[dsf_bts_user] = (1 << 6), .ctl[dsf_bts_user] = (1 << 6),
...@@ -904,7 +904,7 @@ static const struct ds_configuration ds_cfg_netburst = { ...@@ -904,7 +904,7 @@ static const struct ds_configuration ds_cfg_netburst = {
#endif #endif
}; };
static const struct ds_configuration ds_cfg_pentium_m = { static const struct ds_configuration ds_cfg_pentium_m = {
.name = "pentium m", .name = "Pentium M",
.ctl[dsf_bts] = (1 << 6) | (1 << 7), .ctl[dsf_bts] = (1 << 6) | (1 << 7),
.sizeof_field = sizeof(long), .sizeof_field = sizeof(long),
...@@ -915,8 +915,8 @@ static const struct ds_configuration ds_cfg_pentium_m = { ...@@ -915,8 +915,8 @@ static const struct ds_configuration ds_cfg_pentium_m = {
.sizeof_rec[ds_pebs] = sizeof(long) * 18, .sizeof_rec[ds_pebs] = sizeof(long) * 18,
#endif #endif
}; };
static const struct ds_configuration ds_cfg_core2 = { static const struct ds_configuration ds_cfg_core2_atom = {
.name = "core 2", .name = "Core 2/Atom",
.ctl[dsf_bts] = (1 << 6) | (1 << 7), .ctl[dsf_bts] = (1 << 6) | (1 << 7),
.ctl[dsf_bts_kernel] = (1 << 9), .ctl[dsf_bts_kernel] = (1 << 9),
.ctl[dsf_bts_user] = (1 << 10), .ctl[dsf_bts_user] = (1 << 10),
...@@ -949,19 +949,22 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c) ...@@ -949,19 +949,22 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
switch (c->x86) { switch (c->x86) {
case 0x6: case 0x6:
switch (c->x86_model) { switch (c->x86_model) {
case 0 ... 0xC: case 0x9:
/* sorry, don't know about them */ case 0xd: /* Pentium M */
break;
case 0xD:
case 0xE: /* Pentium M */
ds_configure(&ds_cfg_pentium_m); ds_configure(&ds_cfg_pentium_m);
break; break;
default: /* Core2, Atom, ... */ case 0xf:
ds_configure(&ds_cfg_core2); case 0x17: /* Core2 */
case 0x1c: /* Atom */
ds_configure(&ds_cfg_core2_atom);
break;
case 0x1a: /* i7 */
default:
/* sorry, don't know about them */
break; break;
} }
break; break;
case 0xF: case 0xf:
switch (c->x86_model) { switch (c->x86_model) {
case 0x0: case 0x0:
case 0x1: case 0x1:
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/clocksource.h> #include <linux/clocksource.h>
#include <linux/kallsyms.h> #include <linux/kallsyms.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/suspend.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/kthread.h> #include <linux/kthread.h>
...@@ -1965,6 +1966,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, ...@@ -1965,6 +1966,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static atomic_t ftrace_graph_active; static atomic_t ftrace_graph_active;
static struct notifier_block ftrace_suspend_notifier;
int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace) int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
{ {
...@@ -2043,6 +2045,27 @@ static int start_graph_tracing(void) ...@@ -2043,6 +2045,27 @@ static int start_graph_tracing(void)
return ret; return ret;
} }
/*
* Hibernation protection.
* The state of the current task is too much unstable during
* suspend/restore to disk. We want to protect against that.
*/
static int
ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state,
void *unused)
{
switch (state) {
case PM_HIBERNATION_PREPARE:
pause_graph_tracing();
break;
case PM_POST_HIBERNATION:
unpause_graph_tracing();
break;
}
return NOTIFY_DONE;
}
int register_ftrace_graph(trace_func_graph_ret_t retfunc, int register_ftrace_graph(trace_func_graph_ret_t retfunc,
trace_func_graph_ent_t entryfunc) trace_func_graph_ent_t entryfunc)
{ {
...@@ -2050,6 +2073,9 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, ...@@ -2050,6 +2073,9 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
mutex_lock(&ftrace_sysctl_lock); mutex_lock(&ftrace_sysctl_lock);
ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
register_pm_notifier(&ftrace_suspend_notifier);
atomic_inc(&ftrace_graph_active); atomic_inc(&ftrace_graph_active);
ret = start_graph_tracing(); ret = start_graph_tracing();
if (ret) { if (ret) {
...@@ -2075,6 +2101,7 @@ void unregister_ftrace_graph(void) ...@@ -2075,6 +2101,7 @@ void unregister_ftrace_graph(void)
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub; ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
ftrace_graph_entry = ftrace_graph_entry_stub; ftrace_graph_entry = ftrace_graph_entry_stub;
ftrace_shutdown(FTRACE_STOP_FUNC_RET); ftrace_shutdown(FTRACE_STOP_FUNC_RET);
unregister_pm_notifier(&ftrace_suspend_notifier);
mutex_unlock(&ftrace_sysctl_lock); mutex_unlock(&ftrace_sysctl_lock);
} }
......
...@@ -246,7 +246,7 @@ static inline int test_time_stamp(u64 delta) ...@@ -246,7 +246,7 @@ static inline int test_time_stamp(u64 delta)
return 0; return 0;
} }
#define BUF_PAGE_SIZE (PAGE_SIZE - sizeof(struct buffer_data_page)) #define BUF_PAGE_SIZE (PAGE_SIZE - offsetof(struct buffer_data_page, data))
/* /*
* head_page == tail_page && head == tail then buffer is empty. * head_page == tail_page && head == tail then buffer is empty.
...@@ -1025,12 +1025,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -1025,12 +1025,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
} }
if (next_page == head_page) { if (next_page == head_page) {
if (!(buffer->flags & RB_FL_OVERWRITE)) { if (!(buffer->flags & RB_FL_OVERWRITE))
/* reset write */
if (tail <= BUF_PAGE_SIZE)
local_set(&tail_page->write, tail);
goto out_unlock; goto out_unlock;
}
/* tail_page has not moved yet? */ /* tail_page has not moved yet? */
if (tail_page == cpu_buffer->tail_page) { if (tail_page == cpu_buffer->tail_page) {
...@@ -1105,6 +1101,10 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer, ...@@ -1105,6 +1101,10 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
return event; return event;
out_unlock: out_unlock:
/* reset write */
if (tail <= BUF_PAGE_SIZE)
local_set(&tail_page->write, tail);
__raw_spin_unlock(&cpu_buffer->lock); __raw_spin_unlock(&cpu_buffer->lock);
local_irq_restore(flags); local_irq_restore(flags);
return NULL; return NULL;
...@@ -2174,6 +2174,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer) ...@@ -2174,6 +2174,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)
cpu_buffer->overrun = 0; cpu_buffer->overrun = 0;
cpu_buffer->entries = 0; cpu_buffer->entries = 0;
cpu_buffer->write_stamp = 0;
cpu_buffer->read_stamp = 0;
} }
/** /**
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE) #define TRACE_BUFFER_FLAGS (RB_FL_OVERWRITE)
unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX; unsigned long __read_mostly tracing_max_latency;
unsigned long __read_mostly tracing_thresh; unsigned long __read_mostly tracing_thresh;
/* /*
...@@ -3736,7 +3736,7 @@ static struct notifier_block trace_die_notifier = { ...@@ -3736,7 +3736,7 @@ static struct notifier_block trace_die_notifier = {
* it if we decide to change what log level the ftrace dump * it if we decide to change what log level the ftrace dump
* should be at. * should be at.
*/ */
#define KERN_TRACE KERN_INFO #define KERN_TRACE KERN_EMERG
static void static void
trace_printk_seq(struct trace_seq *s) trace_printk_seq(struct trace_seq *s)
...@@ -3770,6 +3770,7 @@ void ftrace_dump(void) ...@@ -3770,6 +3770,7 @@ void ftrace_dump(void)
dump_ran = 1; dump_ran = 1;
/* No turning back! */ /* No turning back! */
tracing_off();
ftrace_kill(); ftrace_kill();
for_each_tracing_cpu(cpu) { for_each_tracing_cpu(cpu) {
......
...@@ -380,6 +380,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr) ...@@ -380,6 +380,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr)
static void __irqsoff_tracer_init(struct trace_array *tr) static void __irqsoff_tracer_init(struct trace_array *tr)
{ {
tracing_max_latency = 0;
irqsoff_trace = tr; irqsoff_trace = tr;
/* make sure that the tracer is visible */ /* make sure that the tracer is visible */
smp_wmb(); smp_wmb();
......
...@@ -333,6 +333,7 @@ static void stop_wakeup_tracer(struct trace_array *tr) ...@@ -333,6 +333,7 @@ static void stop_wakeup_tracer(struct trace_array *tr)
static int wakeup_tracer_init(struct trace_array *tr) static int wakeup_tracer_init(struct trace_array *tr)
{ {
tracing_max_latency = 0;
wakeup_trace = tr; wakeup_trace = tr;
start_wakeup_tracer(tr); start_wakeup_tracer(tr);
return 0; return 0;
......
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