Patches contributed by Eötvös Lorand University
commit ad07e914e681f18ec0eaba60db17f497ee7e7e78
Author: Ingo Molnar <mingo@elte.hu>
Date: Mon Nov 24 11:33:12 2008 +0100
x86 defconfig: increase CONFIG_LOG_BUF_SHIFT
Impact: double the defconfig printk buffer
Booting defconfigs produces more output than 128K so the output is
truncated - double it to 256K.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index 13b8c86ae985..71fc39c70782 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -77,7 +77,7 @@ CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_TREE=y
# CONFIG_IKCONFIG is not set
-CONFIG_LOG_BUF_SHIFT=17
+CONFIG_LOG_BUF_SHIFT=18
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index f0a03d7a7d63..b38bbabc1706 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -77,7 +77,7 @@ CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_TREE=y
# CONFIG_IKCONFIG is not set
-CONFIG_LOG_BUF_SHIFT=17
+CONFIG_LOG_BUF_SHIFT=18
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_NS=y
commit 813b8520f5c240c71df55d14095a7b171de264ce
Merge: ed313489bade 7cc45e64323c
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 13:47:54 2008 +0100
Merge branch 'ppc/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/powerpc
commit 3d994e107694381f5b8b2f5cd9fdc4fcf04a5b79
Merge: a1967d64414d a4a16beadea0
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 12:16:57 2008 +0100
Merge branch 'oprofile-for-tip' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile into x86/urgent
commit 9f1441644213e5f6faa150206399fe511eba2eb6
Merge: 3ff68a6a106c 13d428afc007
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 10:52:33 2008 +0100
Merge commit 'v2.6.28-rc6' into irq/urgent
commit cbe2f5a6e84eebb98ab42fc5e58c3cd5b7767349
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 10:37:12 2008 +0100
tracing: allow tracing of suspend/resume & hibernation code again
Impact: widen function-tracing to suspend+resume (and hibernation) sequences
Now that the ftrace kernel thread is gone, we can allow tracing
during suspend/resume again.
So revert these two commits:
f42ac38c5 "ftrace: disable tracing for suspend to ram"
41108eb10 "ftrace: disable tracing for hibernation"
This should be tested very carefully, as it could interact with
altneratives instruction patching, etc.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index c9d74083746f..f77d3819ef57 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -22,7 +22,6 @@
#include <linux/console.h>
#include <linux/cpu.h>
#include <linux/freezer.h>
-#include <linux/ftrace.h>
#include "power.h"
@@ -257,7 +256,7 @@ static int create_image(int platform_mode)
int hibernation_snapshot(int platform_mode)
{
- int error, ftrace_save;
+ int error;
/* Free memory before shutting down devices. */
error = swsusp_shrink_memory();
@@ -269,7 +268,6 @@ int hibernation_snapshot(int platform_mode)
goto Close;
suspend_console();
- ftrace_save = __ftrace_enabled_save();
error = device_suspend(PMSG_FREEZE);
if (error)
goto Recover_platform;
@@ -299,7 +297,6 @@ int hibernation_snapshot(int platform_mode)
Resume_devices:
device_resume(in_suspend ?
(error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
- __ftrace_enabled_restore(ftrace_save);
resume_console();
Close:
platform_end(platform_mode);
@@ -370,11 +367,10 @@ static int resume_target_kernel(void)
int hibernation_restore(int platform_mode)
{
- int error, ftrace_save;
+ int error;
pm_prepare_console();
suspend_console();
- ftrace_save = __ftrace_enabled_save();
error = device_suspend(PMSG_QUIESCE);
if (error)
goto Finish;
@@ -389,7 +385,6 @@ int hibernation_restore(int platform_mode)
platform_restore_cleanup(platform_mode);
device_resume(PMSG_RECOVER);
Finish:
- __ftrace_enabled_restore(ftrace_save);
resume_console();
pm_restore_console();
return error;
@@ -402,7 +397,7 @@ int hibernation_restore(int platform_mode)
int hibernation_platform_enter(void)
{
- int error, ftrace_save;
+ int error;
if (!hibernation_ops)
return -ENOSYS;
@@ -417,7 +412,6 @@ int hibernation_platform_enter(void)
goto Close;
suspend_console();
- ftrace_save = __ftrace_enabled_save();
error = device_suspend(PMSG_HIBERNATE);
if (error) {
if (hibernation_ops->recover)
@@ -452,7 +446,6 @@ int hibernation_platform_enter(void)
hibernation_ops->finish();
Resume_devices:
device_resume(PMSG_RESTORE);
- __ftrace_enabled_restore(ftrace_save);
resume_console();
Close:
hibernation_ops->end();
diff --git a/kernel/power/main.c b/kernel/power/main.c
index b8f7ce9473e8..613f16941b85 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -22,7 +22,6 @@
#include <linux/freezer.h>
#include <linux/vmstat.h>
#include <linux/syscalls.h>
-#include <linux/ftrace.h>
#include "power.h"
@@ -317,7 +316,7 @@ static int suspend_enter(suspend_state_t state)
*/
int suspend_devices_and_enter(suspend_state_t state)
{
- int error, ftrace_save;
+ int error;
if (!suspend_ops)
return -ENOSYS;
@@ -328,7 +327,6 @@ int suspend_devices_and_enter(suspend_state_t state)
goto Close;
}
suspend_console();
- ftrace_save = __ftrace_enabled_save();
suspend_test_start();
error = device_suspend(PMSG_SUSPEND);
if (error) {
@@ -360,7 +358,6 @@ int suspend_devices_and_enter(suspend_state_t state)
suspend_test_start();
device_resume(PMSG_RESUME);
suspend_test_finish("resume devices");
- __ftrace_enabled_restore(ftrace_save);
resume_console();
Close:
if (suspend_ops->end)
commit 82f60f0bc854aada696f27d863c03bef91f1509d
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 09:18:56 2008 +0100
tracing/function-return-tracer: clean up task start/exit callbacks
Impact: cleanup
Eliminate #ifdefs in core code by using empty inline functions.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index 2ba259b2defa..938ca1942641 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -335,6 +335,9 @@ extern void unregister_ftrace_return(void);
extern void ftrace_retfunc_init_task(struct task_struct *t);
extern void ftrace_retfunc_exit_task(struct task_struct *t);
+#else
+static inline void ftrace_retfunc_init_task(struct task_struct *t) { }
+static inline void ftrace_retfunc_exit_task(struct task_struct *t) { }
#endif
#endif /* _LINUX_FTRACE_H */
diff --git a/kernel/exit.c b/kernel/exit.c
index b9d446329da1..ef04d03b3286 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1128,9 +1128,7 @@ NORET_TYPE void do_exit(long code)
preempt_disable();
/* causes final put_task_struct in finish_task_switch(). */
tsk->state = TASK_DEAD;
-#ifdef CONFIG_FUNCTION_RET_TRACER
ftrace_retfunc_exit_task(tsk);
-#endif
schedule();
BUG();
/* Avoid "noreturn function does return". */
diff --git a/kernel/fork.c b/kernel/fork.c
index d1eb30e69ccc..fbf4a4c0a628 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1270,9 +1270,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
total_forks++;
spin_unlock(¤t->sighand->siglock);
write_unlock_irq(&tasklist_lock);
-#ifdef CONFIG_FUNCTION_RET_TRACER
ftrace_retfunc_init_task(p);
-#endif
proc_fork_connector(p);
cgroup_post_fork(p);
return p;
diff --git a/kernel/sched.c b/kernel/sched.c
index fb17205950de..388d9db044ab 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -5901,9 +5901,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
* The idle tasks have their own, simple scheduling class:
*/
idle->sched_class = &idle_sched_class;
-#ifdef CONFIG_FUNCTION_RET_TRACER
ftrace_retfunc_init_task(idle);
-#endif
}
/*
commit a0a70c735ef714fe1b6777b571630c3d50c7b008
Merge: 9676e73a9e0c 60a515132086 0231022cc32d 522a110b42b3
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 09:10:32 2008 +0100
Merge branches 'tracing/profiling', 'tracing/options' and 'tracing/urgent' into tracing/core
diff --cc kernel/trace/trace.c
index 5653c6b07ba1,697eda36b86a,e97c29a6e7b0,d86e3252f300..4ee6f0375222
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@@@@ -43,15 -43,6 -43,29 -43,6 +43,29 @@@@@
unsigned long __read_mostly tracing_max_latency = (cycle_t)ULONG_MAX;
unsigned long __read_mostly tracing_thresh;
++ +/* For tracers that don't implement custom flags */
++ +static struct tracer_opt dummy_tracer_opt[] = {
++ + { }
++ +};
++ +
++ +static struct tracer_flags dummy_tracer_flags = {
++ + .val = 0,
++ + .opts = dummy_tracer_opt
++ +};
++ +
++ +static int dummy_set_flag(u32 old_flags, u32 bit, int set)
++ +{
++ + return 0;
++ +}
+ +
+ +/*
+ + * Kill all tracing for good (never come back).
+ + * It is initialized to 1 but will turn to zero if the initialization
+ + * of the tracer is successful. But that is the only place that sets
+ + * this back to zero.
+ + */
+ +int tracing_disabled = 1;
+ +
static DEFINE_PER_CPU(local_t, ftrace_cpu_disabled);
static inline void ftrace_disable_cpu(void)
@@@@@ -549,10 -494,11 -563,10 -494,11 +571,10 @@@@@ int register_tracer(struct tracer *type
* internal tracing to verify that everything is in order.
* If we fail, we do not register this tracer.
*/
--- for_each_tracing_cpu(i) {
+++ for_each_tracing_cpu(i)
tracing_reset(tr, i);
--- }
+++
current_trace = type;
- - tr->ctrl = 0;
/* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name);
ret = type->selftest(type, tr);
@@@@@ -815,35 -691,6 -828,36 -691,6 +837,36 @@@@@ trace_function(struct trace_array *tr,
ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
}
+ +#ifdef CONFIG_FUNCTION_RET_TRACER
+ +static void __trace_function_return(struct trace_array *tr,
+ + struct trace_array_cpu *data,
+ + struct ftrace_retfunc *trace,
+ + unsigned long flags,
+ + int pc)
+ +{
+ + struct ring_buffer_event *event;
+ + struct ftrace_ret_entry *entry;
+ + unsigned long irq_flags;
+ +
+ + if (unlikely(local_read(&__get_cpu_var(ftrace_cpu_disabled))))
+ + return;
+ +
+ + event = ring_buffer_lock_reserve(global_trace.buffer, sizeof(*entry),
+ + &irq_flags);
+ + if (!event)
+ + return;
+ + entry = ring_buffer_event_data(event);
+ + tracing_generic_entry_update(&entry->ent, flags, pc);
+ + entry->ent.type = TRACE_FN_RET;
+ + entry->ip = trace->func;
+ + entry->parent_ip = trace->ret;
+ + entry->rettime = trace->rettime;
+ + entry->calltime = trace->calltime;
++ + entry->overrun = trace->overrun;
+ + ring_buffer_unlock_commit(global_trace.buffer, event, irq_flags);
+ +}
+ +#endif
+ +
void
ftrace(struct trace_array *tr, struct trace_array_cpu *data,
unsigned long ip, unsigned long parent_ip, unsigned long flags,
@@@@@ -2433,9 -2188,9 -2446,10 -2189,9 +2456,10 @@@@@ static struct file_operations tracing_c
};
static ssize_t
- -tracing_iter_ctrl_read(struct file *filp, char __user *ubuf,
+ +tracing_trace_options_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
++ + int i;
char *buf;
int r = 0;
int len = 0;
@@@@@ -2469,8 -2224,8 -2503,42 -2225,8 +2513,42 @@@@@
return r;
}
++ +/* Try to assign a tracer specific option */
++ +static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
++ +{
++ + struct tracer_flags *trace_flags = trace->flags;
++ + struct tracer_opt *opts = NULL;
++ + int ret = 0, i = 0;
++ + int len;
++ +
++ + for (i = 0; trace_flags->opts[i].name; i++) {
++ + opts = &trace_flags->opts[i];
++ + len = strlen(opts->name);
++ +
++ + if (strncmp(cmp, opts->name, len) == 0) {
++ + ret = trace->set_flag(trace_flags->val,
++ + opts->bit, !neg);
++ + break;
++ + }
++ + }
++ + /* Not found */
++ + if (!trace_flags->opts[i].name)
++ + return -EINVAL;
++ +
++ + /* Refused to handle */
++ + if (ret)
++ + return ret;
++ +
++ + if (neg)
++ + trace_flags->val &= ~opts->bit;
++ + else
++ + trace_flags->val |= opts->bit;
++ +
++ + return 0;
++ +}
++ +
static ssize_t
- -tracing_iter_ctrl_write(struct file *filp, const char __user *ubuf,
+ +tracing_trace_options_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
char buf[64];
commit f377fa123d0ec621e8e361ecc3f2a8ee70e81a2e
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 09:02:26 2008 +0100
x86: clean up stack overflow debug check
Impact: cleanup
Simplify the irq-sampled stack overflow debug check:
- eliminate an #idef
- use WARN_ONCE() to emit a single warning (all bets are off
after the first such warning anyway)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index b842fc82be15..1d3d0e71b044 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -18,7 +18,6 @@
#include <asm/idle.h>
#include <asm/smp.h>
-#ifdef CONFIG_DEBUG_STACKOVERFLOW
/*
* Probabilistic stack overflow check:
*
@@ -28,20 +27,18 @@
*/
static inline void stack_overflow_check(struct pt_regs *regs)
{
+#ifdef CONFIG_DEBUG_STACKOVERFLOW
u64 curbase = (u64)task_stack_page(current);
- static unsigned long warned = INITIAL_JIFFIES - 60*HZ;
-
- if (regs->sp >= curbase && regs->sp <= curbase + THREAD_SIZE &&
- regs->sp < curbase + sizeof(struct thread_info) +
- sizeof(struct pt_regs) + 128 &&
- time_after(jiffies, warned + 60*HZ)) {
- printk("do_IRQ: %s near stack overflow (cur:%Lx,sp:%lx)\n",
- current->comm, curbase, regs->sp);
- show_stack(NULL,NULL);
- warned = jiffies;
- }
-}
+
+ WARN_ONCE(regs->sp >= curbase &&
+ regs->sp <= curbase + THREAD_SIZE &&
+ regs->sp < curbase + sizeof(struct thread_info) +
+ sizeof(struct pt_regs) + 128,
+
+ "do_IRQ: %s near stack overflow (cur:%Lx,sp:%lx)\n",
+ current->comm, curbase, regs->sp);
#endif
+}
/*
* do_IRQ handles all normal device IRQ's (the special
@@ -61,9 +58,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
irq_enter();
irq = __get_cpu_var(vector_irq)[vector];
-#ifdef CONFIG_DEBUG_STACKOVERFLOW
stack_overflow_check(regs);
-#endif
desc = irq_to_desc(irq);
if (likely(desc))
commit ca9eed76133c00e7f4b1eeb4c1a6cb800cd2654c
Merge: 8652cb4b0d87 13d428afc007
Author: Ingo Molnar <mingo@elte.hu>
Date: Sun Nov 23 08:55:47 2008 +0100
Merge commit 'v2.6.28-rc6' into x86/debug
commit 57550b27ff5a13b00370fbfa34f2471c3456a41d
Merge: bfe085f62f98 13d428afc007
Author: Ingo Molnar <mingo@elte.hu>
Date: Fri Nov 21 20:55:09 2008 +0100
Merge commit 'v2.6.28-rc6' into x86/urgent