aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-08-29 03:30:41 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-29 03:31:47 -0400
commiteebc57f73d42095b778e899f6aa90ad050c72655 (patch)
tree2ba80c75e9284093e6d7606dbb1b6a4bb752a2a5 /kernel/trace/ftrace.c
parentd3a247bfb2c26f5b67367d58af7ad8c2efbbc6c1 (diff)
parent2a4ab640d3c28c2952967e5f63ea495555bf2a5f (diff)
Merge branch 'for-ingo' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-sfi-2.6 into x86/apic
Merge reason: the SFI (Simple Firmware Interface) feature in the ACPI tree needs this cleanup, pull it into the APIC branch as well so that there's no interactions. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c41
1 files changed, 27 insertions, 14 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index bce9e01a29c8..25edd5cc5935 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -768,7 +768,7 @@ static struct tracer_stat function_stats __initdata = {
768 .stat_show = function_stat_show 768 .stat_show = function_stat_show
769}; 769};
770 770
771static void ftrace_profile_debugfs(struct dentry *d_tracer) 771static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
772{ 772{
773 struct ftrace_profile_stat *stat; 773 struct ftrace_profile_stat *stat;
774 struct dentry *entry; 774 struct dentry *entry;
@@ -786,7 +786,6 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
786 * The files created are permanent, if something happens 786 * The files created are permanent, if something happens
787 * we still do not free memory. 787 * we still do not free memory.
788 */ 788 */
789 kfree(stat);
790 WARN(1, 789 WARN(1,
791 "Could not allocate stat file for cpu %d\n", 790 "Could not allocate stat file for cpu %d\n",
792 cpu); 791 cpu);
@@ -813,7 +812,7 @@ static void ftrace_profile_debugfs(struct dentry *d_tracer)
813} 812}
814 813
815#else /* CONFIG_FUNCTION_PROFILER */ 814#else /* CONFIG_FUNCTION_PROFILER */
816static void ftrace_profile_debugfs(struct dentry *d_tracer) 815static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
817{ 816{
818} 817}
819#endif /* CONFIG_FUNCTION_PROFILER */ 818#endif /* CONFIG_FUNCTION_PROFILER */
@@ -1663,7 +1662,7 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
1663 1662
1664 mutex_lock(&ftrace_regex_lock); 1663 mutex_lock(&ftrace_regex_lock);
1665 if ((file->f_mode & FMODE_WRITE) && 1664 if ((file->f_mode & FMODE_WRITE) &&
1666 !(file->f_flags & O_APPEND)) 1665 (file->f_flags & O_TRUNC))
1667 ftrace_filter_reset(enable); 1666 ftrace_filter_reset(enable);
1668 1667
1669 if (file->f_mode & FMODE_READ) { 1668 if (file->f_mode & FMODE_READ) {
@@ -2279,7 +2278,11 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
2279 read++; 2278 read++;
2280 cnt--; 2279 cnt--;
2281 2280
2282 if (!(iter->flags & ~FTRACE_ITER_CONT)) { 2281 /*
2282 * If the parser haven't finished with the last write,
2283 * continue reading the user input without skipping spaces.
2284 */
2285 if (!(iter->flags & FTRACE_ITER_CONT)) {
2283 /* skip white space */ 2286 /* skip white space */
2284 while (cnt && isspace(ch)) { 2287 while (cnt && isspace(ch)) {
2285 ret = get_user(ch, ubuf++); 2288 ret = get_user(ch, ubuf++);
@@ -2289,8 +2292,9 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
2289 cnt--; 2292 cnt--;
2290 } 2293 }
2291 2294
2295 /* only spaces were written */
2292 if (isspace(ch)) { 2296 if (isspace(ch)) {
2293 file->f_pos += read; 2297 *ppos += read;
2294 ret = read; 2298 ret = read;
2295 goto out; 2299 goto out;
2296 } 2300 }
@@ -2320,12 +2324,12 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
2320 if (ret) 2324 if (ret)
2321 goto out; 2325 goto out;
2322 iter->buffer_idx = 0; 2326 iter->buffer_idx = 0;
2323 } else 2327 } else {
2324 iter->flags |= FTRACE_ITER_CONT; 2328 iter->flags |= FTRACE_ITER_CONT;
2329 iter->buffer[iter->buffer_idx++] = ch;
2330 }
2325 2331
2326 2332 *ppos += read;
2327 file->f_pos += read;
2328
2329 ret = read; 2333 ret = read;
2330 out: 2334 out:
2331 mutex_unlock(&ftrace_regex_lock); 2335 mutex_unlock(&ftrace_regex_lock);
@@ -2578,7 +2582,7 @@ ftrace_graph_open(struct inode *inode, struct file *file)
2578 2582
2579 mutex_lock(&graph_lock); 2583 mutex_lock(&graph_lock);
2580 if ((file->f_mode & FMODE_WRITE) && 2584 if ((file->f_mode & FMODE_WRITE) &&
2581 !(file->f_flags & O_APPEND)) { 2585 (file->f_flags & O_TRUNC)) {
2582 ftrace_graph_count = 0; 2586 ftrace_graph_count = 0;
2583 memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs)); 2587 memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs));
2584 } 2588 }
@@ -2597,6 +2601,14 @@ ftrace_graph_open(struct inode *inode, struct file *file)
2597} 2601}
2598 2602
2599static int 2603static int
2604ftrace_graph_release(struct inode *inode, struct file *file)
2605{
2606 if (file->f_mode & FMODE_READ)
2607 seq_release(inode, file);
2608 return 0;
2609}
2610
2611static int
2600ftrace_set_func(unsigned long *array, int *idx, char *buffer) 2612ftrace_set_func(unsigned long *array, int *idx, char *buffer)
2601{ 2613{
2602 struct dyn_ftrace *rec; 2614 struct dyn_ftrace *rec;
@@ -2725,9 +2737,10 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
2725} 2737}
2726 2738
2727static const struct file_operations ftrace_graph_fops = { 2739static const struct file_operations ftrace_graph_fops = {
2728 .open = ftrace_graph_open, 2740 .open = ftrace_graph_open,
2729 .read = seq_read, 2741 .read = seq_read,
2730 .write = ftrace_graph_write, 2742 .write = ftrace_graph_write,
2743 .release = ftrace_graph_release,
2731}; 2744};
2732#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 2745#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
2733 2746