Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141045
b: refs/heads/master
c: fee039a
h: refs/heads/master
i:
  141043: 0da49c3
v: v3
  • Loading branch information
Masami Hiramatsu authored and Ingo Molnar committed Mar 25, 2009
1 parent f5551ca commit 943dbf9
Show file tree
Hide file tree
Showing 18 changed files with 79 additions and 193 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: b14b70a6a4e394c9630bcde17e07d3bcdcbca27e
refs/heads/master: fee039a1d05c6e0f71b0fe270d847742a02d56c4
6 changes: 5 additions & 1 deletion trunk/arch/x86/kernel/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ int ftrace_disable_ftrace_graph_caller(void)
void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
{
unsigned long old;
unsigned long long calltime;
int faulted;
struct ftrace_graph_ent trace;
unsigned long return_hooker = (unsigned long)
Expand Down Expand Up @@ -452,7 +453,10 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
return;
}

if (ftrace_push_return_trace(old, self_addr, &trace.depth) == -EBUSY) {
calltime = trace_clock_local();

if (ftrace_push_return_trace(old, calltime,
self_addr, &trace.depth) == -EBUSY) {
*parent = old;
return;
}
Expand Down
17 changes: 9 additions & 8 deletions trunk/arch/x86/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,13 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
#else
" pushf\n"
/*
* Skip cs, ip, orig_ax.
* Skip cs, ip, orig_ax and gs.
* trampoline_handler() will plug in these values
*/
" subl $12, %esp\n"
" subl $16, %esp\n"
" pushl %fs\n"
" pushl %ds\n"
" pushl %es\n"
" pushl %ds\n"
" pushl %eax\n"
" pushl %ebp\n"
" pushl %edi\n"
Expand All @@ -655,19 +655,19 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
" movl %esp, %eax\n"
" call trampoline_handler\n"
/* Move flags to cs */
" movl 52(%esp), %edx\n"
" movl %edx, 48(%esp)\n"
" movl 56(%esp), %edx\n"
" movl %edx, 52(%esp)\n"
/* Replace saved flags with true return address. */
" movl %eax, 52(%esp)\n"
" movl %eax, 56(%esp)\n"
" popl %ebx\n"
" popl %ecx\n"
" popl %edx\n"
" popl %esi\n"
" popl %edi\n"
" popl %ebp\n"
" popl %eax\n"
/* Skip ip, orig_ax, es, ds, fs */
" addl $20, %esp\n"
/* Skip ds, es, fs, gs, orig_ax and ip */
" addl $24, %esp\n"
" popf\n"
#endif
" ret\n");
Expand All @@ -691,6 +691,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
regs->cs = __KERNEL_CS;
#else
regs->cs = __KERNEL_CS | get_kernel_rpl();
regs->gs = 0;
#endif
regs->ip = trampoline_address;
regs->orig_ax = ~0UL;
Expand Down
16 changes: 0 additions & 16 deletions trunk/fs/debugfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

static struct vfsmount *debugfs_mount;
static int debugfs_mount_count;
static bool debugfs_registered;

static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev)
{
Expand Down Expand Up @@ -497,16 +496,6 @@ struct dentry *debugfs_rename(struct dentry *old_dir, struct dentry *old_dentry,
}
EXPORT_SYMBOL_GPL(debugfs_rename);

/**
* debugfs_initialized - Tells whether debugfs has been registered
*/
bool debugfs_initialized(void)
{
return debugfs_registered;
}
EXPORT_SYMBOL_GPL(debugfs_initialized);


static struct kobject *debug_kobj;

static int __init debugfs_init(void)
Expand All @@ -520,16 +509,11 @@ static int __init debugfs_init(void)
retval = register_filesystem(&debug_fs_type);
if (retval)
kobject_put(debug_kobj);
else
debugfs_registered = true;

return retval;
}

static void __exit debugfs_exit(void)
{
debugfs_registered = false;

simple_release_fs(&debugfs_mount, &debugfs_mount_count);
unregister_filesystem(&debug_fs_type);
kobject_put(debug_kobj);
Expand Down
8 changes: 0 additions & 8 deletions trunk/include/linux/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode,
struct dentry *debugfs_create_blob(const char *name, mode_t mode,
struct dentry *parent,
struct debugfs_blob_wrapper *blob);

bool debugfs_initialized(void);

#else

#include <linux/err.h>
Expand Down Expand Up @@ -186,11 +183,6 @@ static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
return ERR_PTR(-ENODEV);
}

static inline bool debugfs_initialized(void)
{
return false;
}

#endif

#endif
15 changes: 5 additions & 10 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,9 @@ enum {
};

struct dyn_ftrace {
union {
unsigned long ip; /* address of mcount call-site */
struct dyn_ftrace *freelist;
};
union {
unsigned long flags;
struct dyn_ftrace *newlist;
};
struct dyn_arch_ftrace arch;
unsigned long ip; /* address of mcount call-site */
unsigned long flags;
struct dyn_arch_ftrace arch;
};

int ftrace_force_update(void);
Expand Down Expand Up @@ -375,7 +369,8 @@ struct ftrace_ret_stack {
extern void return_to_handler(void);

extern int
ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth);
ftrace_push_return_trace(unsigned long ret, unsigned long long time,
unsigned long func, int *depth);
extern void
ftrace_pop_return_trace(struct ftrace_graph_ret *trace, unsigned long *ret);

Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1409,8 +1409,6 @@ struct task_struct {
int curr_ret_stack;
/* Stack of return addresses for return function tracing */
struct ftrace_ret_stack *ret_stack;
/* time stamp for last schedule */
unsigned long long ftrace_timestamp;
/*
* Number of functions that haven't been traced
* because of depth overrun.
Expand Down
3 changes: 2 additions & 1 deletion trunk/init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,6 @@ static void __init do_basic_setup(void)
{
rcu_init_sched(); /* needed by module_init stage. */
init_workqueues();
cpuset_init_smp();
usermodehelper_init();
driver_init();
init_irq_proc();
Expand Down Expand Up @@ -866,6 +865,8 @@ static int __init kernel_init(void * unused)
smp_init();
sched_init_smp();

cpuset_init_smp();

do_basic_setup();

/*
Expand Down
6 changes: 1 addition & 5 deletions trunk/kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ config TRACING
#
config TRACING_SUPPORT
bool
# PPC32 has no irqflags tracing support, but it can use most of the
# tracers anyway, they were tested to build and work. Note that new
# exceptions to this list aren't welcomed, better implement the
# irqflags tracing for your architecture.
depends on TRACE_IRQFLAGS_SUPPORT || PPC32
depends on TRACE_IRQFLAGS_SUPPORT
depends on STACKTRACE_SUPPORT
default y

Expand Down
68 changes: 7 additions & 61 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
#include <linux/list.h>
#include <linux/hash.h>

#include <trace/sched.h>

#include <asm/ftrace.h>

#include "trace.h"
Expand Down Expand Up @@ -341,7 +339,7 @@ static inline int record_frozen(struct dyn_ftrace *rec)

static void ftrace_free_rec(struct dyn_ftrace *rec)
{
rec->freelist = ftrace_free_records;
rec->ip = (unsigned long)ftrace_free_records;
ftrace_free_records = rec;
rec->flags |= FTRACE_FL_FREE;
}
Expand All @@ -358,14 +356,9 @@ void ftrace_release(void *start, unsigned long size)

mutex_lock(&ftrace_lock);
do_for_each_ftrace_rec(pg, rec) {
if ((rec->ip >= s) && (rec->ip < e)) {
/*
* rec->ip is changed in ftrace_free_rec()
* It should not between s and e if record was freed.
*/
FTRACE_WARN_ON(rec->flags & FTRACE_FL_FREE);
if ((rec->ip >= s) && (rec->ip < e) &&
!(rec->flags & FTRACE_FL_FREE))
ftrace_free_rec(rec);
}
} while_for_each_ftrace_rec();
mutex_unlock(&ftrace_lock);
}
Expand All @@ -384,7 +377,7 @@ static struct dyn_ftrace *ftrace_alloc_dyn_node(unsigned long ip)
return NULL;
}

ftrace_free_records = rec->freelist;
ftrace_free_records = (void *)rec->ip;
memset(rec, 0, sizeof(*rec));
return rec;
}
Expand Down Expand Up @@ -416,7 +409,7 @@ ftrace_record_ip(unsigned long ip)
return NULL;

rec->ip = ip;
rec->newlist = ftrace_new_addrs;
rec->flags = (unsigned long)ftrace_new_addrs;
ftrace_new_addrs = rec;

return rec;
Expand Down Expand Up @@ -736,7 +729,7 @@ static int ftrace_update_code(struct module *mod)
return -1;

p = ftrace_new_addrs;
ftrace_new_addrs = p->newlist;
ftrace_new_addrs = (struct dyn_ftrace *)p->flags;
p->flags = 0L;

/* convert record (i.e, patch mcount-call with NOP) */
Expand Down Expand Up @@ -2269,7 +2262,7 @@ ftrace_pid_read(struct file *file, char __user *ubuf,
if (ftrace_pid_trace == ftrace_swapper_pid)
r = sprintf(buf, "swapper tasks\n");
else if (ftrace_pid_trace)
r = sprintf(buf, "%u\n", pid_vnr(ftrace_pid_trace));
r = sprintf(buf, "%u\n", pid_nr(ftrace_pid_trace));
else
r = sprintf(buf, "no pid\n");

Expand Down Expand Up @@ -2597,38 +2590,6 @@ static int alloc_retstack_tasklist(struct ftrace_ret_stack **ret_stack_list)
return ret;
}

static void
ftrace_graph_probe_sched_switch(struct rq *__rq, struct task_struct *prev,
struct task_struct *next)
{
unsigned long long timestamp;
int index;

/*
* Does the user want to count the time a function was asleep.
* If so, do not update the time stamps.
*/
if (trace_flags & TRACE_ITER_SLEEP_TIME)
return;

timestamp = trace_clock_local();

prev->ftrace_timestamp = timestamp;

/* only process tasks that we timestamped */
if (!next->ftrace_timestamp)
return;

/*
* Update all the counters in next to make up for the
* time next was sleeping.
*/
timestamp -= next->ftrace_timestamp;

for (index = next->curr_ret_stack; index >= 0; index--)
next->ret_stack[index].calltime += timestamp;
}

/* Allocate a return stack for each task */
static int start_graph_tracing(void)
{
Expand All @@ -2650,13 +2611,6 @@ static int start_graph_tracing(void)
ret = alloc_retstack_tasklist(ret_stack_list);
} while (ret == -EAGAIN);

if (!ret) {
ret = register_trace_sched_switch(ftrace_graph_probe_sched_switch);
if (ret)
pr_info("ftrace_graph: Couldn't activate tracepoint"
" probe to kernel_sched_switch\n");
}

kfree(ret_stack_list);
return ret;
}
Expand Down Expand Up @@ -2689,12 +2643,6 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,

mutex_lock(&ftrace_lock);

/* we currently allow only one tracer registered at a time */
if (atomic_read(&ftrace_graph_active)) {
ret = -EBUSY;
goto out;
}

ftrace_suspend_notifier.notifier_call = ftrace_suspend_notifier_call;
register_pm_notifier(&ftrace_suspend_notifier);

Expand All @@ -2720,7 +2668,6 @@ void unregister_ftrace_graph(void)
mutex_lock(&ftrace_lock);

atomic_dec(&ftrace_graph_active);
unregister_trace_sched_switch(ftrace_graph_probe_sched_switch);
ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
ftrace_graph_entry = ftrace_graph_entry_stub;
ftrace_shutdown(FTRACE_STOP_FUNC_RET);
Expand All @@ -2741,7 +2688,6 @@ void ftrace_graph_init_task(struct task_struct *t)
t->curr_ret_stack = -1;
atomic_set(&t->tracing_graph_pause, 0);
atomic_set(&t->trace_overrun, 0);
t->ftrace_timestamp = 0;
} else
t->ret_stack = NULL;
}
Expand Down
8 changes: 2 additions & 6 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);

/* trace_flags holds trace_options default values */
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT | TRACE_ITER_PRINTK |
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO | TRACE_ITER_SLEEP_TIME;
TRACE_ITER_ANNOTATE | TRACE_ITER_CONTEXT_INFO;

/**
* trace_wake_up - wake up tasks waiting for trace input
Expand Down Expand Up @@ -316,7 +316,6 @@ static const char *trace_options[] = {
"context-info",
"latency-format",
"global-clock",
"sleep-time",
NULL
};

Expand Down Expand Up @@ -383,7 +382,7 @@ ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
return cnt;
}

static ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt)
ssize_t trace_seq_to_buffer(struct trace_seq *s, void *buf, size_t cnt)
{
int len;
void *ret;
Expand Down Expand Up @@ -3514,9 +3513,6 @@ struct dentry *tracing_init_dentry(void)
if (d_tracer)
return d_tracer;

if (!debugfs_initialized())
return NULL;

d_tracer = debugfs_create_dir("tracing", NULL);

if (!d_tracer && !once) {
Expand Down
Loading

0 comments on commit 943dbf9

Please sign in to comment.