From: Li Zefan <lizf@cn.fujitsu.com>
To: Steven Whitehouse <swhiteho@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, cluster-devel@redhat.com,
Christoph Hellwig <hch@infradead.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: trace: fix multiple use of __print_flags and __print_symbolic
Date: Wed, 03 Jun 2009 17:50:04 +0800 [thread overview]
Message-ID: <4A26474C.1000900@cn.fujitsu.com> (raw)
In-Reply-To: <1244019900.29604.588.camel@localhost.localdomain>
Steven Whitehouse wrote:
> When using multiple calls to __print_symbolic and __print_flags in
> the same tracer, I noticed that the output was incorrect. I think
> the following patch is the correct fix (it works for me) but please
> check it carefully since I'm not that familiar with this code,
> and I may well have made a mistake somewhere.
>
I don't see there's bug in __print_symbolic() or __print_flags():
enum print_line_t
ftrace_raw_output_##call(struct trace_iterator *iter, int flags)
{
...
p = &get_cpu_var(ftrace_event_seq);
/* here we call ftrace_print_flags_seq(p, ...) */
ret = trace_seq_printf(s, #call ": " print);
put_cpu();
...
}
ftrace_event_seq is percpu data, and here is used with preempt-disabled,
so there shouldn't be problem of concurrent accessing.
> The patch is vs. the latest -tip tree which doesn't yet seem to
> contain the EXPORT_SYMBOL() fix that I sent earlier.
>
> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
>
>
> diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
> index c12d95d..ac6ced1 100644
> --- a/kernel/trace/trace_output.c
> +++ b/kernel/trace/trace_output.c
> @@ -222,10 +222,9 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
> {
> unsigned long mask;
> const char *str;
> + const char *ret = p->buffer + p->len;
> int i;
>
> - trace_seq_init(p);
> -
This is wrong. Without reseting, the seq buffer will quickly be filled.
> for (i = 0; flag_array[i].name && flags; i++) {
>
> mask = flag_array[i].mask;
> @@ -248,7 +247,7 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
>
> trace_seq_putc(p, 0);
>
> - return p->buffer;
> + return ret;
> }
>
> const char *
> @@ -256,8 +255,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
> const struct trace_print_flags *symbol_array)
> {
> int i;
> -
> - trace_seq_init(p);
> + const char *ret = p->buffer + p->len;
>
> for (i = 0; symbol_array[i].name; i++) {
>
> @@ -273,7 +271,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
>
> trace_seq_putc(p, 0);
>
> - return p->buffer;
> + return ret;
> }
>
> #ifdef CONFIG_KRETPROBES
>
next prev parent reply other threads:[~2009-06-03 9:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 9:05 [Cluster-devel] trace: fix multiple use of __print_flags and __print_symbolic Steven Whitehouse
2009-06-03 9:05 ` Steven Whitehouse
2009-06-03 9:50 ` Li Zefan [this message]
2009-06-03 9:54 ` [Cluster-devel] " Steven Whitehouse
2009-06-03 9:54 ` Steven Whitehouse
2009-06-03 12:57 ` [Cluster-devel] " Steven Whitehouse
2009-06-03 12:57 ` Steven Whitehouse
2009-06-03 13:23 ` Steven Rostedt
2009-06-03 13:52 ` [Cluster-devel] " Steven Whitehouse
2009-06-03 13:52 ` Steven Whitehouse
2009-06-07 10:22 ` [tip:tracing/core] tracing: " tip-bot for Steven Whitehouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A26474C.1000900@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=cluster-devel@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.