Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257120
b: refs/heads/master
c: e4a3f54
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Jul 8, 2011
1 parent adf5456 commit fef4c42
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 166 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: 492f73a303b488ffd67097b2351d54aa6e6c7c73
refs/heads/master: e4a3f541f0b67fdad98b326c851dfe7f4b6b6dad
7 changes: 3 additions & 4 deletions trunk/include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

#include <asm/ftrace.h>

struct ftrace_hash;

#ifdef CONFIG_FUNCTION_TRACER

extern int ftrace_enabled;
Expand All @@ -31,6 +29,8 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,

typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);

struct ftrace_hash;

enum {
FTRACE_OPS_FL_ENABLED = 1 << 0,
FTRACE_OPS_FL_GLOBAL = 1 << 1,
Expand Down Expand Up @@ -123,8 +123,7 @@ stack_trace_sysctl(struct ctl_table *table, int write,
struct ftrace_func_command {
struct list_head list;
char *name;
int (*func)(struct ftrace_hash *hash,
char *func, char *cmd,
int (*func)(char *func, char *cmd,
char *params, int enable);
};

Expand Down
14 changes: 5 additions & 9 deletions trunk/kernel/jump_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,19 +375,15 @@ int jump_label_text_reserved(void *start, void *end)

static void jump_label_update(struct jump_label_key *key, int enable)
{
struct jump_entry *entry = key->entries, *stop = __stop___jump_table;
struct jump_entry *entry = key->entries;

#ifdef CONFIG_MODULES
struct module *mod = __module_address((jump_label_t)key);
/* if there are no users, entry can be NULL */
if (entry)
__jump_label_update(key, entry, __stop___jump_table, enable);

#ifdef CONFIG_MODULES
__jump_label_mod_update(key, enable);

if (mod)
stop = mod->jump_entries + mod->num_jump_entries;
#endif
/* if there are no users, entry can be NULL */
if (entry)
__jump_label_update(key, entry, stop, enable);
}

#endif
42 changes: 11 additions & 31 deletions trunk/kernel/trace/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1732,36 +1732,10 @@ static cycle_t ftrace_update_time;
static unsigned long ftrace_update_cnt;
unsigned long ftrace_update_tot_cnt;

static int ops_traces_mod(struct ftrace_ops *ops)
{
struct ftrace_hash *hash;

hash = ops->filter_hash;
return !!(!hash || !hash->count);
}

static int ftrace_update_code(struct module *mod)
{
struct dyn_ftrace *p;
cycle_t start, stop;
unsigned long ref = 0;

/*
* When adding a module, we need to check if tracers are
* currently enabled and if they are set to trace all functions.
* If they are, we need to enable the module functions as well
* as update the reference counts for those function records.
*/
if (mod) {
struct ftrace_ops *ops;

for (ops = ftrace_ops_list;
ops != &ftrace_list_end; ops = ops->next) {
if (ops->flags & FTRACE_OPS_FL_ENABLED &&
ops_traces_mod(ops))
ref++;
}
}

start = ftrace_now(raw_smp_processor_id());
ftrace_update_cnt = 0;
Expand All @@ -1774,7 +1748,7 @@ static int ftrace_update_code(struct module *mod)

p = ftrace_new_addrs;
ftrace_new_addrs = p->newlist;
p->flags = ref;
p->flags = 0L;

/*
* Do the initial record conversion from mcount jump
Expand All @@ -1797,7 +1771,7 @@ static int ftrace_update_code(struct module *mod)
* conversion puts the module to the correct state, thus
* passing the ftrace_make_call check.
*/
if (ftrace_start_up && ref) {
if (ftrace_start_up) {
int failed = __ftrace_replace_code(p, 1);
if (failed) {
ftrace_bug(failed, p->ip);
Expand Down Expand Up @@ -2421,9 +2395,10 @@ ftrace_match_module_records(struct ftrace_hash *hash, char *buff, char *mod)
*/

static int
ftrace_mod_callback(struct ftrace_hash *hash,
char *func, char *cmd, char *param, int enable)
ftrace_mod_callback(char *func, char *cmd, char *param, int enable)
{
struct ftrace_ops *ops = &global_ops;
struct ftrace_hash *hash;
char *mod;
int ret = -EINVAL;

Expand All @@ -2443,6 +2418,11 @@ ftrace_mod_callback(struct ftrace_hash *hash,
if (!strlen(mod))
return ret;

if (enable)
hash = ops->filter_hash;
else
hash = ops->notrace_hash;

ret = ftrace_match_module_records(hash, func, mod);
if (!ret)
ret = -EINVAL;
Expand Down Expand Up @@ -2768,7 +2748,7 @@ static int ftrace_process_regex(struct ftrace_hash *hash,
mutex_lock(&ftrace_cmd_mutex);
list_for_each_entry(p, &ftrace_commands, list) {
if (strcmp(p->name, command) == 0) {
ret = p->func(hash, func, command, next, enable);
ret = p->func(func, command, next, enable);
goto out_unlock;
}
}
Expand Down
51 changes: 34 additions & 17 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,29 @@ struct tracer {
};


/* Only current can touch trace_recursion */
#define trace_recursion_inc() do { (current)->trace_recursion++; } while (0)
#define trace_recursion_dec() do { (current)->trace_recursion--; } while (0)

/* Ring buffer has the 10 LSB bits to count */
#define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff)

/* for function tracing recursion */
#define TRACE_INTERNAL_BIT (1<<11)
#define TRACE_GLOBAL_BIT (1<<12)
/*
* Abuse of the trace_recursion.
* As we need a way to maintain state if we are tracing the function
* graph in irq because we want to trace a particular function that
* was called in irq context but we have irq tracing off. Since this
* can only be modified by current, we can reuse trace_recursion.
*/
#define TRACE_IRQ_BIT (1<<13)

#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0)
#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0)
#define trace_recursion_test(bit) ((current)->trace_recursion & (bit))

#define TRACE_PIPE_ALL_CPU -1

int tracer_init(struct tracer *t, struct trace_array *tr);
Expand Down Expand Up @@ -516,8 +539,18 @@ static inline int ftrace_graph_addr(unsigned long addr)
return 1;

for (i = 0; i < ftrace_graph_count; i++) {
if (addr == ftrace_graph_funcs[i])
if (addr == ftrace_graph_funcs[i]) {
/*
* If no irqs are to be traced, but a set_graph_function
* is set, and called by an interrupt handler, we still
* want to trace it.
*/
if (in_irq())
trace_recursion_set(TRACE_IRQ_BIT);
else
trace_recursion_clear(TRACE_IRQ_BIT);
return 1;
}
}

return 0;
Expand Down Expand Up @@ -687,7 +720,6 @@ struct event_subsystem {
struct dentry *entry;
struct event_filter *filter;
int nr_events;
int ref_count;
};

#define FILTER_PRED_INVALID ((unsigned short)-1)
Expand Down Expand Up @@ -795,19 +827,4 @@ extern const char *__stop___trace_bprintk_fmt[];
FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print))
#include "trace_entries.h"

/* Only current can touch trace_recursion */
#define trace_recursion_inc() do { (current)->trace_recursion++; } while (0)
#define trace_recursion_dec() do { (current)->trace_recursion--; } while (0)

/* Ring buffer has the 10 LSB bits to count */
#define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff)

/* for function tracing recursion */
#define TRACE_INTERNAL_BIT (1<<11)
#define TRACE_GLOBAL_BIT (1<<12)

#define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0)
#define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0)
#define trace_recursion_test(bit) ((current)->trace_recursion & (bit))

#endif /* _LINUX_KERNEL_TRACE_H */
Loading

0 comments on commit fef4c42

Please sign in to comment.