aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-07-21 15:44:18 -0400
committerIngo Molnar <mingo@elte.hu>2010-07-21 15:44:18 -0400
commit23c2875725ebb03e58e598754309e198648f608a (patch)
tree35f9ffe9e7b52624642cb651687dea5faf5dc6a3 /kernel/trace/trace.c
parent9dcdbf7a33d9018ac5d45debcf261be648bdd56a (diff)
parentb444786f1a797a7f84e2561346a670649f9c7b3c (diff)
Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing into perf/core
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c73
1 files changed, 15 insertions, 58 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 8683dec6946b..c1752dac613e 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1331,61 +1331,6 @@ static void __trace_userstack(struct trace_array *tr, unsigned long flags)
1331 1331
1332#endif /* CONFIG_STACKTRACE */ 1332#endif /* CONFIG_STACKTRACE */
1333 1333
1334static void
1335ftrace_trace_special(void *__tr,
1336 unsigned long arg1, unsigned long arg2, unsigned long arg3,
1337 int pc)
1338{
1339 struct ftrace_event_call *call = &event_special;
1340 struct ring_buffer_event *event;
1341 struct trace_array *tr = __tr;
1342 struct ring_buffer *buffer = tr->buffer;
1343 struct special_entry *entry;
1344
1345 event = trace_buffer_lock_reserve(buffer, TRACE_SPECIAL,
1346 sizeof(*entry), 0, pc);
1347 if (!event)
1348 return;
1349 entry = ring_buffer_event_data(event);
1350 entry->arg1 = arg1;
1351 entry->arg2 = arg2;
1352 entry->arg3 = arg3;
1353
1354 if (!filter_check_discard(call, entry, buffer, event))
1355 trace_buffer_unlock_commit(buffer, event, 0, pc);
1356}
1357
1358void
1359__trace_special(void *__tr, void *__data,
1360 unsigned long arg1, unsigned long arg2, unsigned long arg3)
1361{
1362 ftrace_trace_special(__tr, arg1, arg2, arg3, preempt_count());
1363}
1364
1365void
1366ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
1367{
1368 struct trace_array *tr = &global_trace;
1369 struct trace_array_cpu *data;
1370 unsigned long flags;
1371 int cpu;
1372 int pc;
1373
1374 if (tracing_disabled)
1375 return;
1376
1377 pc = preempt_count();
1378 local_irq_save(flags);
1379 cpu = raw_smp_processor_id();
1380 data = tr->data[cpu];
1381
1382 if (likely(atomic_inc_return(&data->disabled) == 1))
1383 ftrace_trace_special(tr, arg1, arg2, arg3, pc);
1384
1385 atomic_dec(&data->disabled);
1386 local_irq_restore(flags);
1387}
1388
1389/** 1334/**
1390 * trace_vbprintk - write binary msg to tracing buffer 1335 * trace_vbprintk - write binary msg to tracing buffer
1391 * 1336 *
@@ -2393,6 +2338,7 @@ static const struct file_operations show_traces_fops = {
2393 .open = show_traces_open, 2338 .open = show_traces_open,
2394 .read = seq_read, 2339 .read = seq_read,
2395 .release = seq_release, 2340 .release = seq_release,
2341 .llseek = seq_lseek,
2396}; 2342};
2397 2343
2398/* 2344/*
@@ -2486,6 +2432,7 @@ static const struct file_operations tracing_cpumask_fops = {
2486 .open = tracing_open_generic, 2432 .open = tracing_open_generic,
2487 .read = tracing_cpumask_read, 2433 .read = tracing_cpumask_read,
2488 .write = tracing_cpumask_write, 2434 .write = tracing_cpumask_write,
2435 .llseek = generic_file_llseek,
2489}; 2436};
2490 2437
2491static int tracing_trace_options_show(struct seq_file *m, void *v) 2438static int tracing_trace_options_show(struct seq_file *m, void *v)
@@ -2652,6 +2599,7 @@ tracing_readme_read(struct file *filp, char __user *ubuf,
2652static const struct file_operations tracing_readme_fops = { 2599static const struct file_operations tracing_readme_fops = {
2653 .open = tracing_open_generic, 2600 .open = tracing_open_generic,
2654 .read = tracing_readme_read, 2601 .read = tracing_readme_read,
2602 .llseek = generic_file_llseek,
2655}; 2603};
2656 2604
2657static ssize_t 2605static ssize_t
@@ -2702,6 +2650,7 @@ tracing_saved_cmdlines_read(struct file *file, char __user *ubuf,
2702static const struct file_operations tracing_saved_cmdlines_fops = { 2650static const struct file_operations tracing_saved_cmdlines_fops = {
2703 .open = tracing_open_generic, 2651 .open = tracing_open_generic,
2704 .read = tracing_saved_cmdlines_read, 2652 .read = tracing_saved_cmdlines_read,
2653 .llseek = generic_file_llseek,
2705}; 2654};
2706 2655
2707static ssize_t 2656static ssize_t
@@ -3031,6 +2980,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
3031 if (iter->trace->pipe_open) 2980 if (iter->trace->pipe_open)
3032 iter->trace->pipe_open(iter); 2981 iter->trace->pipe_open(iter);
3033 2982
2983 nonseekable_open(inode, filp);
3034out: 2984out:
3035 mutex_unlock(&trace_types_lock); 2985 mutex_unlock(&trace_types_lock);
3036 return ret; 2986 return ret;
@@ -3589,18 +3539,21 @@ static const struct file_operations tracing_max_lat_fops = {
3589 .open = tracing_open_generic, 3539 .open = tracing_open_generic,
3590 .read = tracing_max_lat_read, 3540 .read = tracing_max_lat_read,
3591 .write = tracing_max_lat_write, 3541 .write = tracing_max_lat_write,
3542 .llseek = generic_file_llseek,
3592}; 3543};
3593 3544
3594static const struct file_operations tracing_ctrl_fops = { 3545static const struct file_operations tracing_ctrl_fops = {
3595 .open = tracing_open_generic, 3546 .open = tracing_open_generic,
3596 .read = tracing_ctrl_read, 3547 .read = tracing_ctrl_read,
3597 .write = tracing_ctrl_write, 3548 .write = tracing_ctrl_write,
3549 .llseek = generic_file_llseek,
3598}; 3550};
3599 3551
3600static const struct file_operations set_tracer_fops = { 3552static const struct file_operations set_tracer_fops = {
3601 .open = tracing_open_generic, 3553 .open = tracing_open_generic,
3602 .read = tracing_set_trace_read, 3554 .read = tracing_set_trace_read,
3603 .write = tracing_set_trace_write, 3555 .write = tracing_set_trace_write,
3556 .llseek = generic_file_llseek,
3604}; 3557};
3605 3558
3606static const struct file_operations tracing_pipe_fops = { 3559static const struct file_operations tracing_pipe_fops = {
@@ -3609,17 +3562,20 @@ static const struct file_operations tracing_pipe_fops = {
3609 .read = tracing_read_pipe, 3562 .read = tracing_read_pipe,
3610 .splice_read = tracing_splice_read_pipe, 3563 .splice_read = tracing_splice_read_pipe,
3611 .release = tracing_release_pipe, 3564 .release = tracing_release_pipe,
3565 .llseek = no_llseek,
3612}; 3566};
3613 3567
3614static const struct file_operations tracing_entries_fops = { 3568static const struct file_operations tracing_entries_fops = {
3615 .open = tracing_open_generic, 3569 .open = tracing_open_generic,
3616 .read = tracing_entries_read, 3570 .read = tracing_entries_read,
3617 .write = tracing_entries_write, 3571 .write = tracing_entries_write,
3572 .llseek = generic_file_llseek,
3618}; 3573};
3619 3574
3620static const struct file_operations tracing_mark_fops = { 3575static const struct file_operations tracing_mark_fops = {
3621 .open = tracing_open_generic, 3576 .open = tracing_open_generic,
3622 .write = tracing_mark_write, 3577 .write = tracing_mark_write,
3578 .llseek = generic_file_llseek,
3623}; 3579};
3624 3580
3625static const struct file_operations trace_clock_fops = { 3581static const struct file_operations trace_clock_fops = {
@@ -3925,6 +3881,7 @@ tracing_stats_read(struct file *filp, char __user *ubuf,
3925static const struct file_operations tracing_stats_fops = { 3881static const struct file_operations tracing_stats_fops = {
3926 .open = tracing_open_generic, 3882 .open = tracing_open_generic,
3927 .read = tracing_stats_read, 3883 .read = tracing_stats_read,
3884 .llseek = generic_file_llseek,
3928}; 3885};
3929 3886
3930#ifdef CONFIG_DYNAMIC_FTRACE 3887#ifdef CONFIG_DYNAMIC_FTRACE
@@ -3961,6 +3918,7 @@ tracing_read_dyn_info(struct file *filp, char __user *ubuf,
3961static const struct file_operations tracing_dyn_info_fops = { 3918static const struct file_operations tracing_dyn_info_fops = {
3962 .open = tracing_open_generic, 3919 .open = tracing_open_generic,
3963 .read = tracing_read_dyn_info, 3920 .read = tracing_read_dyn_info,
3921 .llseek = generic_file_llseek,
3964}; 3922};
3965#endif 3923#endif
3966 3924
@@ -4114,6 +4072,7 @@ static const struct file_operations trace_options_fops = {
4114 .open = tracing_open_generic, 4072 .open = tracing_open_generic,
4115 .read = trace_options_read, 4073 .read = trace_options_read,
4116 .write = trace_options_write, 4074 .write = trace_options_write,
4075 .llseek = generic_file_llseek,
4117}; 4076};
4118 4077
4119static ssize_t 4078static ssize_t
@@ -4165,6 +4124,7 @@ static const struct file_operations trace_options_core_fops = {
4165 .open = tracing_open_generic, 4124 .open = tracing_open_generic,
4166 .read = trace_options_core_read, 4125 .read = trace_options_core_read,
4167 .write = trace_options_core_write, 4126 .write = trace_options_core_write,
4127 .llseek = generic_file_llseek,
4168}; 4128};
4169 4129
4170struct dentry *trace_create_file(const char *name, 4130struct dentry *trace_create_file(const char *name,
@@ -4354,9 +4314,6 @@ static __init int tracer_init_debugfs(void)
4354 trace_create_file("dyn_ftrace_total_info", 0444, d_tracer, 4314 trace_create_file("dyn_ftrace_total_info", 0444, d_tracer,
4355 &ftrace_update_tot_cnt, &tracing_dyn_info_fops); 4315 &ftrace_update_tot_cnt, &tracing_dyn_info_fops);
4356#endif 4316#endif
4357#ifdef CONFIG_SYSPROF_TRACER
4358 init_tracer_sysprof_debugfs(d_tracer);
4359#endif
4360 4317
4361 create_trace_options_dir(); 4318 create_trace_options_dir();
4362 4319