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

Commit f6490438 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@
 * - buffer allocation (memory accounting)
 *
 *
 * Copyright (C) 2007-2008 Intel Corporation.
 * Markus Metzger <markus.t.metzger@intel.com>, 2007-2008
 * Copyright (C) 2007-2009 Intel Corporation.
 * Markus Metzger <markus.t.metzger@intel.com>, 2007-2009
 */


@@ -890,7 +890,7 @@ int ds_set_pebs_reset(struct pebs_tracer *tracer, u64 value)
}

static const struct ds_configuration ds_cfg_netburst = {
	.name = "netburst",
	.name = "Netburst",
	.ctl[dsf_bts]		= (1 << 2) | (1 << 3),
	.ctl[dsf_bts_kernel]	= (1 << 5),
	.ctl[dsf_bts_user]	= (1 << 6),
@@ -904,7 +904,7 @@ static const struct ds_configuration ds_cfg_netburst = {
#endif
};
static const struct ds_configuration ds_cfg_pentium_m = {
	.name = "pentium m",
	.name = "Pentium M",
	.ctl[dsf_bts]		= (1 << 6) | (1 << 7),

	.sizeof_field		= sizeof(long),
@@ -915,8 +915,8 @@ static const struct ds_configuration ds_cfg_pentium_m = {
	.sizeof_rec[ds_pebs]	= sizeof(long) * 18,
#endif
};
static const struct ds_configuration ds_cfg_core2 = {
	.name = "core 2",
static const struct ds_configuration ds_cfg_core2_atom = {
	.name = "Core 2/Atom",
	.ctl[dsf_bts]		= (1 << 6) | (1 << 7),
	.ctl[dsf_bts_kernel]	= (1 << 9),
	.ctl[dsf_bts_user]	= (1 << 10),
@@ -949,19 +949,22 @@ void __cpuinit ds_init_intel(struct cpuinfo_x86 *c)
	switch (c->x86) {
	case 0x6:
		switch (c->x86_model) {
		case 0 ... 0xC:
			/* sorry, don't know about them */
			break;
		case 0xD:
		case 0xE: /* Pentium M */
		case 0x9:
		case 0xd: /* Pentium M */
			ds_configure(&ds_cfg_pentium_m);
			break;
		default: /* Core2, Atom, ... */
			ds_configure(&ds_cfg_core2);
		case 0xf:
		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;
	case 0xF:
	case 0xf:
		switch (c->x86_model) {
		case 0x0:
		case 0x1:
+27 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/clocksource.h>
#include <linux/kallsyms.h>
#include <linux/seq_file.h>
#include <linux/suspend.h>
#include <linux/debugfs.h>
#include <linux/hardirq.h>
#include <linux/kthread.h>
@@ -1965,6 +1966,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
#ifdef CONFIG_FUNCTION_GRAPH_TRACER

static atomic_t ftrace_graph_active;
static struct notifier_block ftrace_suspend_notifier;

int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace)
{
@@ -2043,6 +2045,27 @@ static int start_graph_tracing(void)
	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,
			trace_func_graph_ent_t entryfunc)
{
@@ -2050,6 +2073,9 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,

	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);
	ret = start_graph_tracing();
	if (ret) {
@@ -2075,6 +2101,7 @@ void unregister_ftrace_graph(void)
	ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
	ftrace_graph_entry = ftrace_graph_entry_stub;
	ftrace_shutdown(FTRACE_STOP_FUNC_RET);
	unregister_pm_notifier(&ftrace_suspend_notifier);

	mutex_unlock(&ftrace_sysctl_lock);
}
+9 −6
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ static inline int test_time_stamp(u64 delta)
	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.
@@ -1025,12 +1025,8 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
		}

		if (next_page == head_page) {
			if (!(buffer->flags & RB_FL_OVERWRITE)) {
				/* reset write */
				if (tail <= BUF_PAGE_SIZE)
					local_set(&tail_page->write, tail);
			if (!(buffer->flags & RB_FL_OVERWRITE))
				goto out_unlock;
			}

			/* tail_page has not moved yet? */
			if (tail_page == cpu_buffer->tail_page) {
@@ -1105,6 +1101,10 @@ __rb_reserve_next(struct ring_buffer_per_cpu *cpu_buffer,
	return event;

 out_unlock:
	/* reset write */
	if (tail <= BUF_PAGE_SIZE)
		local_set(&tail_page->write, tail);

	__raw_spin_unlock(&cpu_buffer->lock);
	local_irq_restore(flags);
	return NULL;
@@ -2174,6 +2174,9 @@ rb_reset_cpu(struct ring_buffer_per_cpu *cpu_buffer)

	cpu_buffer->overrun = 0;
	cpu_buffer->entries = 0;

	cpu_buffer->write_stamp = 0;
	cpu_buffer->read_stamp = 0;
}

/**
+3 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@

#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;

/*
@@ -3736,7 +3736,7 @@ static struct notifier_block trace_die_notifier = {
 * it if we decide to change what log level the ftrace dump
 * should be at.
 */
#define KERN_TRACE		KERN_INFO
#define KERN_TRACE		KERN_EMERG

static void
trace_printk_seq(struct trace_seq *s)
@@ -3770,6 +3770,7 @@ void ftrace_dump(void)
	dump_ran = 1;

	/* No turning back! */
	tracing_off();
	ftrace_kill();

	for_each_tracing_cpu(cpu) {
+1 −0
Original line number Diff line number Diff line
@@ -380,6 +380,7 @@ static void stop_irqsoff_tracer(struct trace_array *tr)

static void __irqsoff_tracer_init(struct trace_array *tr)
{
	tracing_max_latency = 0;
	irqsoff_trace = tr;
	/* make sure that the tracer is visible */
	smp_wmb();
Loading