Merge commit 'v2.6.32-rc5' into perf/probes
Conflicts: kernel/trace/trace_event_profile.c Merge reason: update to -rc5 and resolve conflict. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -855,6 +855,37 @@ static void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
|
||||
sizeof(r), &r);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_rq_remap - Add a trace for a request-remap operation
|
||||
* @q: queue the io is for
|
||||
* @rq: the source request
|
||||
* @dev: target device
|
||||
* @from: source sector
|
||||
*
|
||||
* Description:
|
||||
* Device mapper remaps request to other devices.
|
||||
* Add a trace for that action.
|
||||
*
|
||||
**/
|
||||
static void blk_add_trace_rq_remap(struct request_queue *q,
|
||||
struct request *rq, dev_t dev,
|
||||
sector_t from)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
struct blk_io_trace_remap r;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
r.device_from = cpu_to_be32(dev);
|
||||
r.device_to = cpu_to_be32(disk_devt(rq->rq_disk));
|
||||
r.sector_from = cpu_to_be64(from);
|
||||
|
||||
__blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq),
|
||||
rq_data_dir(rq), BLK_TA_REMAP, !!rq->errors,
|
||||
sizeof(r), &r);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_driver_data - Add binary message with driver-specific data
|
||||
* @q: queue the io is for
|
||||
@@ -922,10 +953,13 @@ static void blk_register_tracepoints(void)
|
||||
WARN_ON(ret);
|
||||
ret = register_trace_block_remap(blk_add_trace_remap);
|
||||
WARN_ON(ret);
|
||||
ret = register_trace_block_rq_remap(blk_add_trace_rq_remap);
|
||||
WARN_ON(ret);
|
||||
}
|
||||
|
||||
static void blk_unregister_tracepoints(void)
|
||||
{
|
||||
unregister_trace_block_rq_remap(blk_add_trace_rq_remap);
|
||||
unregister_trace_block_remap(blk_add_trace_remap);
|
||||
unregister_trace_block_split(blk_add_trace_split);
|
||||
unregister_trace_block_unplug_io(blk_add_trace_unplug_io);
|
||||
@@ -1657,6 +1691,11 @@ int blk_trace_init_sysfs(struct device *dev)
|
||||
return sysfs_create_group(&dev->kobj, &blk_trace_attr_group);
|
||||
}
|
||||
|
||||
void blk_trace_remove_sysfs(struct device *dev)
|
||||
{
|
||||
sysfs_remove_group(&dev->kobj, &blk_trace_attr_group);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLK_DEV_IO_TRACE */
|
||||
|
||||
#ifdef CONFIG_EVENT_TRACING
|
||||
|
@@ -225,7 +225,11 @@ static void ftrace_update_pid_func(void)
|
||||
if (ftrace_trace_function == ftrace_stub)
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
|
||||
func = ftrace_trace_function;
|
||||
#else
|
||||
func = __ftrace_trace_function;
|
||||
#endif
|
||||
|
||||
if (ftrace_pid_trace) {
|
||||
set_ftrace_pid_function(func);
|
||||
@@ -1074,14 +1078,9 @@ static void ftrace_replace_code(int enable)
|
||||
failed = __ftrace_replace_code(rec, enable);
|
||||
if (failed) {
|
||||
rec->flags |= FTRACE_FL_FAILED;
|
||||
if ((system_state == SYSTEM_BOOTING) ||
|
||||
!core_kernel_text(rec->ip)) {
|
||||
ftrace_free_rec(rec);
|
||||
} else {
|
||||
ftrace_bug(failed, rec->ip);
|
||||
/* Stop processing */
|
||||
return;
|
||||
}
|
||||
ftrace_bug(failed, rec->ip);
|
||||
/* Stop processing */
|
||||
return;
|
||||
}
|
||||
} while_for_each_ftrace_rec();
|
||||
}
|
||||
@@ -1621,8 +1620,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
|
||||
if (!ret) {
|
||||
struct seq_file *m = file->private_data;
|
||||
m->private = iter;
|
||||
} else
|
||||
} else {
|
||||
trace_parser_put(&iter->parser);
|
||||
kfree(iter);
|
||||
}
|
||||
} else
|
||||
file->private_data = iter;
|
||||
mutex_unlock(&ftrace_regex_lock);
|
||||
@@ -2202,7 +2203,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
|
||||
struct trace_parser *parser;
|
||||
ssize_t ret, read;
|
||||
|
||||
if (!cnt || cnt < 0)
|
||||
if (!cnt)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&ftrace_regex_lock);
|
||||
@@ -2216,7 +2217,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
|
||||
parser = &iter->parser;
|
||||
read = trace_get_user(parser, ubuf, cnt, ppos);
|
||||
|
||||
if (trace_parser_loaded(parser) &&
|
||||
if (read >= 0 && trace_parser_loaded(parser) &&
|
||||
!trace_parser_cont(parser)) {
|
||||
ret = ftrace_process_regex(parser->buffer,
|
||||
parser->idx, enable);
|
||||
@@ -2552,8 +2553,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos)
|
||||
{
|
||||
struct trace_parser parser;
|
||||
size_t read = 0;
|
||||
ssize_t ret;
|
||||
ssize_t read, ret;
|
||||
|
||||
if (!cnt || cnt < 0)
|
||||
return 0;
|
||||
@@ -2562,29 +2562,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
|
||||
|
||||
if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
read = trace_get_user(&parser, ubuf, cnt, ppos);
|
||||
|
||||
if (trace_parser_loaded((&parser))) {
|
||||
if (read >= 0 && trace_parser_loaded((&parser))) {
|
||||
parser.buffer[parser.idx] = 0;
|
||||
|
||||
/* we allow only one expression at a time */
|
||||
ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
|
||||
parser.buffer);
|
||||
if (ret)
|
||||
goto out;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
ret = read;
|
||||
out:
|
||||
|
||||
out_free:
|
||||
trace_parser_put(&parser);
|
||||
out_unlock:
|
||||
mutex_unlock(&graph_lock);
|
||||
|
||||
return ret;
|
||||
@@ -2655,19 +2657,17 @@ static int ftrace_convert_nops(struct module *mod,
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MODULES
|
||||
void ftrace_release(void *start, void *end)
|
||||
void ftrace_release_mod(struct module *mod)
|
||||
{
|
||||
struct dyn_ftrace *rec;
|
||||
struct ftrace_page *pg;
|
||||
unsigned long s = (unsigned long)start;
|
||||
unsigned long e = (unsigned long)end;
|
||||
|
||||
if (ftrace_disabled || !start || start == end)
|
||||
if (ftrace_disabled)
|
||||
return;
|
||||
|
||||
mutex_lock(&ftrace_lock);
|
||||
do_for_each_ftrace_rec(pg, rec) {
|
||||
if ((rec->ip >= s) && (rec->ip < e)) {
|
||||
if (within_module_core(rec->ip, mod)) {
|
||||
/*
|
||||
* rec->ip is changed in ftrace_free_rec()
|
||||
* It should not between s and e if record was freed.
|
||||
@@ -2699,9 +2699,7 @@ static int ftrace_module_notify(struct notifier_block *self,
|
||||
mod->num_ftrace_callsites);
|
||||
break;
|
||||
case MODULE_STATE_GOING:
|
||||
ftrace_release(mod->ftrace_callsites,
|
||||
mod->ftrace_callsites +
|
||||
mod->num_ftrace_callsites);
|
||||
ftrace_release_mod(mod);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3015,7 +3013,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
|
||||
|
||||
int
|
||||
ftrace_enable_sysctl(struct ctl_table *table, int write,
|
||||
struct file *file, void __user *buffer, size_t *lenp,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos)
|
||||
{
|
||||
int ret;
|
||||
@@ -3025,7 +3023,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
|
||||
|
||||
mutex_lock(&ftrace_lock);
|
||||
|
||||
ret = proc_dointvec(table, write, file, buffer, lenp, ppos);
|
||||
ret = proc_dointvec(table, write, buffer, lenp, ppos);
|
||||
|
||||
if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled))
|
||||
goto out;
|
||||
|
@@ -501,7 +501,7 @@ static int __init init_kmem_tracer(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!register_tracer(&kmem_tracer)) {
|
||||
if (register_tracer(&kmem_tracer) != 0) {
|
||||
pr_warning("Warning: could not register the kmem tracer\n");
|
||||
return 1;
|
||||
}
|
||||
|
@@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
|
||||
|
||||
/* read the non-space input */
|
||||
while (cnt && !isspace(ch)) {
|
||||
if (parser->idx < parser->size)
|
||||
if (parser->idx < parser->size - 1)
|
||||
parser->buffer[parser->idx++] = ch;
|
||||
else {
|
||||
ret = -EINVAL;
|
||||
@@ -1393,7 +1393,7 @@ int trace_array_vprintk(struct trace_array *tr,
|
||||
|
||||
int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
|
||||
{
|
||||
return trace_array_printk(&global_trace, ip, fmt, args);
|
||||
return trace_array_vprintk(&global_trace, ip, fmt, args);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(trace_vprintk);
|
||||
|
||||
@@ -1984,11 +1984,9 @@ __tracing_open(struct inode *inode, struct file *file)
|
||||
if (current_trace)
|
||||
*iter->trace = *current_trace;
|
||||
|
||||
if (!alloc_cpumask_var(&iter->started, GFP_KERNEL))
|
||||
if (!zalloc_cpumask_var(&iter->started, GFP_KERNEL))
|
||||
goto fail;
|
||||
|
||||
cpumask_clear(iter->started);
|
||||
|
||||
if (current_trace && current_trace->print_max)
|
||||
iter->tr = &max_tr;
|
||||
else
|
||||
@@ -4389,7 +4387,7 @@ __init static int tracer_alloc_buffers(void)
|
||||
if (!alloc_cpumask_var(&tracing_cpumask, GFP_KERNEL))
|
||||
goto out_free_buffer_mask;
|
||||
|
||||
if (!alloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL))
|
||||
if (!zalloc_cpumask_var(&tracing_reader_cpumask, GFP_KERNEL))
|
||||
goto out_free_tracing_cpumask;
|
||||
|
||||
/* To save memory, keep the ring buffer size to its minimum */
|
||||
@@ -4400,7 +4398,6 @@ __init static int tracer_alloc_buffers(void)
|
||||
|
||||
cpumask_copy(tracing_buffer_mask, cpu_possible_mask);
|
||||
cpumask_copy(tracing_cpumask, cpu_all_mask);
|
||||
cpumask_clear(tracing_reader_cpumask);
|
||||
|
||||
/* TODO: make the number of buffers hot pluggable with CPUS */
|
||||
global_trace.buffer = ring_buffer_alloc(ring_buf_size,
|
||||
|
@@ -34,6 +34,7 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
|
||||
struct trace_array *tr = branch_tracer;
|
||||
struct ring_buffer_event *event;
|
||||
struct trace_branch *entry;
|
||||
struct ring_buffer *buffer;
|
||||
unsigned long flags;
|
||||
int cpu, pc;
|
||||
const char *p;
|
||||
@@ -54,7 +55,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
|
||||
goto out;
|
||||
|
||||
pc = preempt_count();
|
||||
event = trace_buffer_lock_reserve(tr, TRACE_BRANCH,
|
||||
buffer = tr->buffer;
|
||||
event = trace_buffer_lock_reserve(buffer, TRACE_BRANCH,
|
||||
sizeof(*entry), flags, pc);
|
||||
if (!event)
|
||||
goto out;
|
||||
@@ -74,8 +76,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
|
||||
entry->line = f->line;
|
||||
entry->correct = val == expect;
|
||||
|
||||
if (!filter_check_discard(call, entry, tr->buffer, event))
|
||||
ring_buffer_unlock_commit(tr->buffer, event);
|
||||
if (!filter_check_discard(call, entry, buffer, event))
|
||||
ring_buffer_unlock_commit(buffer, event);
|
||||
|
||||
out:
|
||||
atomic_dec(&tr->data[cpu]->disabled);
|
||||
|
@@ -31,7 +31,7 @@ static int ftrace_profile_enable_event(struct ftrace_event_call *event)
|
||||
if (atomic_inc_return(&event->profile_count))
|
||||
return 0;
|
||||
|
||||
if (!total_profile_count++) {
|
||||
if (!total_profile_count) {
|
||||
buf = (char *)alloc_percpu(profile_buf_t);
|
||||
if (!buf)
|
||||
goto fail_buf;
|
||||
@@ -46,14 +46,19 @@ static int ftrace_profile_enable_event(struct ftrace_event_call *event)
|
||||
}
|
||||
|
||||
ret = event->profile_enable(event);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
total_profile_count++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
kfree(trace_profile_buf_nmi);
|
||||
fail_buf_nmi:
|
||||
kfree(trace_profile_buf);
|
||||
if (!total_profile_count) {
|
||||
free_percpu(trace_profile_buf_nmi);
|
||||
free_percpu(trace_profile_buf);
|
||||
trace_profile_buf_nmi = NULL;
|
||||
trace_profile_buf = NULL;
|
||||
}
|
||||
fail_buf:
|
||||
total_profile_count--;
|
||||
atomic_dec(&event->profile_count);
|
||||
|
||||
return ret;
|
||||
|
@@ -228,10 +228,9 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos)
|
||||
{
|
||||
struct trace_parser parser;
|
||||
size_t read = 0;
|
||||
ssize_t ret;
|
||||
ssize_t read, ret;
|
||||
|
||||
if (!cnt || cnt < 0)
|
||||
if (!cnt)
|
||||
return 0;
|
||||
|
||||
ret = tracing_update_buffers();
|
||||
@@ -243,7 +242,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf,
|
||||
|
||||
read = trace_get_user(&parser, ubuf, cnt, ppos);
|
||||
|
||||
if (trace_parser_loaded((&parser))) {
|
||||
if (read >= 0 && trace_parser_loaded((&parser))) {
|
||||
int set = 1;
|
||||
|
||||
if (*parser.buffer == '!')
|
||||
|
@@ -933,8 +933,9 @@ static void postfix_clear(struct filter_parse_state *ps)
|
||||
|
||||
while (!list_empty(&ps->postfix)) {
|
||||
elt = list_first_entry(&ps->postfix, struct postfix_elt, list);
|
||||
kfree(elt->operand);
|
||||
list_del(&elt->list);
|
||||
kfree(elt->operand);
|
||||
kfree(elt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -165,6 +165,7 @@ void trace_hw_branch(u64 from, u64 to)
|
||||
struct ftrace_event_call *call = &event_hw_branch;
|
||||
struct trace_array *tr = hw_branch_trace;
|
||||
struct ring_buffer_event *event;
|
||||
struct ring_buffer *buf;
|
||||
struct hw_branch_entry *entry;
|
||||
unsigned long irq1;
|
||||
int cpu;
|
||||
@@ -180,7 +181,8 @@ void trace_hw_branch(u64 from, u64 to)
|
||||
if (atomic_inc_return(&tr->data[cpu]->disabled) != 1)
|
||||
goto out;
|
||||
|
||||
event = trace_buffer_lock_reserve(tr, TRACE_HW_BRANCHES,
|
||||
buf = tr->buffer;
|
||||
event = trace_buffer_lock_reserve(buf, TRACE_HW_BRANCHES,
|
||||
sizeof(*entry), 0, 0);
|
||||
if (!event)
|
||||
goto out;
|
||||
@@ -189,8 +191,8 @@ void trace_hw_branch(u64 from, u64 to)
|
||||
entry->ent.type = TRACE_HW_BRANCHES;
|
||||
entry->from = from;
|
||||
entry->to = to;
|
||||
if (!filter_check_discard(call, entry, tr->buffer, event))
|
||||
trace_buffer_unlock_commit(tr, event, 0, 0);
|
||||
if (!filter_check_discard(call, entry, buf, event))
|
||||
trace_buffer_unlock_commit(buf, event, 0, 0);
|
||||
|
||||
out:
|
||||
atomic_dec(&tr->data[cpu]->disabled);
|
||||
|
@@ -486,16 +486,18 @@ int trace_print_lat_fmt(struct trace_seq *s, struct trace_entry *entry)
|
||||
hardirq ? 'h' : softirq ? 's' : '.'))
|
||||
return 0;
|
||||
|
||||
if (entry->lock_depth < 0)
|
||||
ret = trace_seq_putc(s, '.');
|
||||
if (entry->preempt_count)
|
||||
ret = trace_seq_printf(s, "%x", entry->preempt_count);
|
||||
else
|
||||
ret = trace_seq_printf(s, "%d", entry->lock_depth);
|
||||
ret = trace_seq_putc(s, '.');
|
||||
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
if (entry->preempt_count)
|
||||
return trace_seq_printf(s, "%x", entry->preempt_count);
|
||||
return trace_seq_putc(s, '.');
|
||||
if (entry->lock_depth < 0)
|
||||
return trace_seq_putc(s, '.');
|
||||
|
||||
return trace_seq_printf(s, "%d", entry->lock_depth);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -883,7 +885,7 @@ static int trace_ctxwake_raw(struct trace_iterator *iter, char S)
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
if (!S)
|
||||
task_state_char(field->prev_state);
|
||||
S = task_state_char(field->prev_state);
|
||||
T = task_state_char(field->next_state);
|
||||
if (!trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n",
|
||||
field->prev_pid,
|
||||
@@ -918,7 +920,7 @@ static int trace_ctxwake_hex(struct trace_iterator *iter, char S)
|
||||
trace_assign_type(field, iter->ent);
|
||||
|
||||
if (!S)
|
||||
task_state_char(field->prev_state);
|
||||
S = task_state_char(field->prev_state);
|
||||
T = task_state_char(field->next_state);
|
||||
|
||||
SEQ_PUT_HEX_FIELD_RET(s, field->prev_pid);
|
||||
|
@@ -296,14 +296,14 @@ static const struct file_operations stack_trace_fops = {
|
||||
|
||||
int
|
||||
stack_trace_sysctl(struct ctl_table *table, int write,
|
||||
struct file *file, void __user *buffer, size_t *lenp,
|
||||
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);
|
||||
ret = proc_dointvec(table, write, buffer, lenp, ppos);
|
||||
|
||||
if (ret || !write ||
|
||||
(last_stack_tracer_enabled == !!stack_tracer_enabled))
|
||||
|
@@ -166,7 +166,7 @@ int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
|
||||
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
|
||||
"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n",
|
||||
SYSCALL_FIELD(int, nr),
|
||||
SYSCALL_FIELD(unsigned long, ret));
|
||||
SYSCALL_FIELD(long, ret));
|
||||
if (!ret)
|
||||
return 0;
|
||||
|
||||
@@ -212,7 +212,7 @@ int syscall_exit_define_fields(struct ftrace_event_call *call)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = trace_define_field(call, SYSCALL_FIELD(unsigned long, ret), 0,
|
||||
ret = trace_define_field(call, SYSCALL_FIELD(long, ret), 0,
|
||||
FILTER_OTHER);
|
||||
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user