Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 121296
b: refs/heads/master
c: 6d102bc
h: refs/heads/master
v: v3
  • Loading branch information
Lai Jiangshan authored and Ingo Molnar committed Dec 18, 2008
1 parent fd928ab commit 33d579c
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 97 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c71dd42db2c6f1637b92502a214587431c1a6ad2
refs/heads/master: 6d102bc68f3dd2ae0e305b09170b1751aa67baeb
4 changes: 0 additions & 4 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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: <num>
Set the STI (builtin display/keyboard on the HP-PARISC
Expand Down
8 changes: 0 additions & 8 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <asm/ftrace.h>
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/trace/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions trunk/kernel/sysctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 4 additions & 9 deletions trunk/kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
15 changes: 2 additions & 13 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] == '*') {
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 1 addition & 3 deletions trunk/kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ struct ring_buffer_per_cpu {
};

struct ring_buffer {
unsigned long size;
unsigned pages;
unsigned flags;
int cpus;
Expand Down Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion trunk/kernel/trace/trace_sched_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,3 @@ __init static int init_sched_switch_trace(void)
return register_tracer(&sched_switch_trace);
}
device_initcall(init_sched_switch_trace);

49 changes: 4 additions & 45 deletions trunk/kernel/trace/trace_stack.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <linux/debugfs.h>
#include <linux/ftrace.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/init.h>
#include <linux/fs.h>
#include "trace.h"
Expand All @@ -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)
{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 33d579c

Please sign in to comment.