From 33d579c2cbf3e498724a80778af29ccd334f8501 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Wed, 17 Dec 2008 17:48:23 +0800 Subject: [PATCH] --- yaml --- r: 121296 b: refs/heads/master c: 6d102bc68f3dd2ae0e305b09170b1751aa67baeb h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/kernel-parameters.txt | 4 -- trunk/include/linux/ftrace.h | 8 ---- trunk/include/trace/sched.h | 4 +- trunk/kernel/sched.c | 2 +- trunk/kernel/sysctl.c | 10 ----- trunk/kernel/trace/Kconfig | 13 ++---- trunk/kernel/trace/ftrace.c | 15 +------ trunk/kernel/trace/ring_buffer.c | 4 +- trunk/kernel/trace/trace.c | 1 + trunk/kernel/trace/trace_sched_switch.c | 1 - trunk/kernel/trace/trace_stack.c | 49 ++--------------------- 12 files changed, 16 insertions(+), 97 deletions(-) diff --git a/[refs] b/[refs] index 88ca85dea63c..de09f9a1e472 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c71dd42db2c6f1637b92502a214587431c1a6ad2 +refs/heads/master: 6d102bc68f3dd2ae0e305b09170b1751aa67baeb diff --git a/trunk/Documentation/kernel-parameters.txt b/trunk/Documentation/kernel-parameters.txt index edab81c13182..2919a2e91938 100644 --- a/trunk/Documentation/kernel-parameters.txt +++ b/trunk/Documentation/kernel-parameters.txt @@ -89,7 +89,6 @@ parameter is applicable: SPARC Sparc architecture is enabled. SWSUSP Software suspend (hibernation) is enabled. SUSPEND System suspend states are enabled. - FTRACE Function tracing enabled. TS Appropriate touchscreen support is enabled. USB USB support is enabled. USBHID USB Human Interface Device support is enabled. @@ -2174,9 +2173,6 @@ and is between 256 and 4096 characters. It is defined in the file st= [HW,SCSI] SCSI tape parameters (buffers, etc.) See Documentation/scsi/st.txt. - stacktrace [FTRACE] - Enabled the stack tracer on boot up. - sti= [PARISC,HW] Format: Set the STI (builtin display/keyboard on the HP-PARISC diff --git a/trunk/include/linux/ftrace.h b/trunk/include/linux/ftrace.h index 6b0db53caa7d..44020f31bd81 100644 --- a/trunk/include/linux/ftrace.h +++ b/trunk/include/linux/ftrace.h @@ -86,14 +86,6 @@ static inline void ftrace_stop(void) { } static inline void ftrace_start(void) { } #endif /* CONFIG_FUNCTION_TRACER */ -#ifdef CONFIG_STACK_TRACER -extern int stack_tracer_enabled; -int -stack_trace_sysctl(struct ctl_table *table, int write, - struct file *file, void __user *buffer, size_t *lenp, - loff_t *ppos); -#endif - #ifdef CONFIG_DYNAMIC_FTRACE /* asm/ftrace.h must be defined for archs supporting dynamic ftrace */ #include diff --git a/trunk/include/trace/sched.h b/trunk/include/trace/sched.h index bc4c9eadc6ba..f4549d506b16 100644 --- a/trunk/include/trace/sched.h +++ b/trunk/include/trace/sched.h @@ -21,8 +21,8 @@ DECLARE_TRACE(sched_wakeup, TPARGS(rq, p)); DECLARE_TRACE(sched_wakeup_new, - TPPROTO(struct rq *rq, struct task_struct *p, int success), - TPARGS(rq, p, success)); + TPPROTO(struct rq *rq, struct task_struct *p), + TPARGS(rq, p)); DECLARE_TRACE(sched_switch, TPPROTO(struct rq *rq, struct task_struct *prev, diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index ac5a70a87d1e..d377097572f9 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -2457,7 +2457,7 @@ void wake_up_new_task(struct task_struct *p, unsigned long clone_flags) p->sched_class->task_new(rq, p); inc_nr_running(rq); } - trace_sched_wakeup_new(rq, p, 1); + trace_sched_wakeup_new(rq, p); check_preempt_curr(rq, p, 0); #ifdef CONFIG_SMP if (p->sched_class->task_wake_up) diff --git a/trunk/kernel/sysctl.c b/trunk/kernel/sysctl.c index 6ac501a2dcc6..c83f566e940a 100644 --- a/trunk/kernel/sysctl.c +++ b/trunk/kernel/sysctl.c @@ -487,16 +487,6 @@ static struct ctl_table kern_table[] = { .proc_handler = &ftrace_enable_sysctl, }, #endif -#ifdef CONFIG_STACK_TRACER - { - .ctl_name = CTL_UNNUMBERED, - .procname = "stack_tracer_enabled", - .data = &stack_tracer_enabled, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = &stack_trace_sysctl, - }, -#endif #ifdef CONFIG_TRACING { .ctl_name = CTL_UNNUMBERED, diff --git a/trunk/kernel/trace/Kconfig b/trunk/kernel/trace/Kconfig index e2a4ff6fc3a6..d8bae6f4219e 100644 --- a/trunk/kernel/trace/Kconfig +++ b/trunk/kernel/trace/Kconfig @@ -244,15 +244,10 @@ config STACK_TRACER This tracer works by hooking into every function call that the kernel executes, and keeping a maximum stack depth value and - stack-trace saved. If this is configured with DYNAMIC_FTRACE - then it will not have any overhead while the stack tracer - is disabled. - - To enable the stack tracer on bootup, pass in 'stacktrace' - on the kernel command line. - - The stack tracer can also be enabled or disabled via the - sysctl kernel.stack_tracer_enabled + stack-trace saved. Because this logic has to execute in every + kernel function, all the time, this option can slow down the + kernel measurably and is generally intended for kernel + developers only. Say N if unsure. diff --git a/trunk/kernel/trace/ftrace.c b/trunk/kernel/trace/ftrace.c index 2f32969c09df..a12f80efceaa 100644 --- a/trunk/kernel/trace/ftrace.c +++ b/trunk/kernel/trace/ftrace.c @@ -1047,13 +1047,6 @@ ftrace_match(unsigned char *buff, int len, int enable) int type = MATCH_FULL; unsigned long flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE; unsigned i, match = 0, search_len = 0; - int not = 0; - - if (buff[0] == '!') { - not = 1; - buff++; - len--; - } for (i = 0; i < len; i++) { if (buff[i] == '*') { @@ -1107,12 +1100,8 @@ ftrace_match(unsigned char *buff, int len, int enable) matched = 1; break; } - if (matched) { - if (not) - rec->flags &= ~flag; - else - rec->flags |= flag; - } + if (matched) + rec->flags |= flag; } pg = pg->next; } diff --git a/trunk/kernel/trace/ring_buffer.c b/trunk/kernel/trace/ring_buffer.c index eab81f918f6a..bb6922a931b1 100644 --- a/trunk/kernel/trace/ring_buffer.c +++ b/trunk/kernel/trace/ring_buffer.c @@ -258,7 +258,6 @@ struct ring_buffer_per_cpu { }; struct ring_buffer { - unsigned long size; unsigned pages; unsigned flags; int cpus; @@ -2210,8 +2209,7 @@ int ring_buffer_swap_cpu(struct ring_buffer *buffer_a, return -EINVAL; /* At least make sure the two buffers are somewhat the same */ - if (buffer_a->size != buffer_b->size || - buffer_a->pages != buffer_b->pages) + if (buffer_a->pages != buffer_b->pages) return -EINVAL; cpu_buffer_a = buffer_a->buffers[cpu]; diff --git a/trunk/kernel/trace/trace.c b/trunk/kernel/trace/trace.c index 49fc7201295e..1a3d6b329782 100644 --- a/trunk/kernel/trace/trace.c +++ b/trunk/kernel/trace/trace.c @@ -1816,6 +1816,7 @@ print_lat_fmt(struct trace_iterator *iter, unsigned int trace_idx, int cpu) char *comm; int S, T; int i; + unsigned state; if (entry->type == TRACE_CONT) return TRACE_TYPE_HANDLED; diff --git a/trunk/kernel/trace/trace_sched_switch.c b/trunk/kernel/trace/trace_sched_switch.c index 781d72ef873c..863390557b44 100644 --- a/trunk/kernel/trace/trace_sched_switch.c +++ b/trunk/kernel/trace/trace_sched_switch.c @@ -247,4 +247,3 @@ __init static int init_sched_switch_trace(void) return register_tracer(&sched_switch_trace); } device_initcall(init_sched_switch_trace); - diff --git a/trunk/kernel/trace/trace_stack.c b/trunk/kernel/trace/trace_stack.c index d0871bc0aca5..0b863f2cbc8e 100644 --- a/trunk/kernel/trace/trace_stack.c +++ b/trunk/kernel/trace/trace_stack.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include "trace.h" @@ -32,10 +31,6 @@ static raw_spinlock_t max_stack_lock = static int stack_trace_disabled __read_mostly; static DEFINE_PER_CPU(int, trace_active); -static DEFINE_MUTEX(stack_sysctl_mutex); - -int stack_tracer_enabled; -static int last_stack_tracer_enabled; static inline void check_stack(void) { @@ -179,7 +174,7 @@ stack_max_size_write(struct file *filp, const char __user *ubuf, return count; } -static const struct file_operations stack_max_size_fops = { +static struct file_operations stack_max_size_fops = { .open = tracing_open_generic, .read = stack_max_size_read, .write = stack_max_size_write, @@ -277,7 +272,7 @@ static int t_show(struct seq_file *m, void *v) return 0; } -static const struct seq_operations stack_trace_seq_ops = { +static struct seq_operations stack_trace_seq_ops = { .start = t_start, .next = t_next, .stop = t_stop, @@ -293,47 +288,12 @@ static int stack_trace_open(struct inode *inode, struct file *file) return ret; } -static const struct file_operations stack_trace_fops = { +static struct file_operations stack_trace_fops = { .open = stack_trace_open, .read = seq_read, .llseek = seq_lseek, }; -int -stack_trace_sysctl(struct ctl_table *table, int write, - struct file *file, void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - int ret; - - mutex_lock(&stack_sysctl_mutex); - - ret = proc_dointvec(table, write, file, buffer, lenp, ppos); - - if (ret || !write || - (last_stack_tracer_enabled == stack_tracer_enabled)) - goto out; - - last_stack_tracer_enabled = stack_tracer_enabled; - - if (stack_tracer_enabled) - register_ftrace_function(&trace_ops); - else - unregister_ftrace_function(&trace_ops); - - out: - mutex_unlock(&stack_sysctl_mutex); - return ret; -} - -static __init int enable_stacktrace(char *str) -{ - stack_tracer_enabled = 1; - last_stack_tracer_enabled = 1; - return 1; -} -__setup("stacktrace", enable_stacktrace); - static __init int stack_trace_init(void) { struct dentry *d_tracer; @@ -351,8 +311,7 @@ static __init int stack_trace_init(void) if (!entry) pr_warning("Could not create debugfs 'stack_trace' entry\n"); - if (stack_tracer_enabled) - register_ftrace_function(&trace_ops); + register_ftrace_function(&trace_ops); return 0; }