From: Steven Whitehouse <swhiteho@redhat.com>
To: Li Zefan <lizf@cn.fujitsu.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 10:54:49 +0100 [thread overview]
Message-ID: <1244022889.29604.595.camel@localhost.localdomain> (raw)
In-Reply-To: <4A26474C.1000900@cn.fujitsu.com>
Hi,
On Wed, 2009-06-03 at 17:50 +0800, Li Zefan wrote:
> 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.
>
>
Well without the "fix" every call to __print_symbolic and __print_flags
seems to result in printing the same string, so with:
TP_printk("%u.%u glock %d:%lld state %s => %s tgt:%s dmt:%s flags:%s",
MAJOR(__entry->dev), MINOR(__entry->dev), __entry->gltype,
(unsigned long long)__entry->glnum,
glock_trace_name(__entry->cur_state),
glock_trace_name(__entry->new_state),
glock_trace_name(__entry->tgt_state),
glock_trace_name(__entry->dmt_state),
show_glock_flags(__entry->flags))
and
#define dlm_state_name(nn) { DLM_LOCK_##nn, #nn }
#define glock_trace_name(x) __print_symbolic(x, \
dlm_state_name(IV), \
dlm_state_name(NL), \
dlm_state_name(CR), \
dlm_state_name(CW), \
dlm_state_name(PR), \
dlm_state_name(PW), \
dlm_state_name(EX))
#define show_glock_flags(flags) __print_flags(flags, "", \
{(1UL << GLF_LOCK), "l" }, \
{(1UL << GLF_DEMOTE), "D" }, \
{(1UL << GLF_PENDING_DEMOTE), "d" }, \
{(1UL << GLF_DEMOTE_IN_PROGRESS), "p" }, \
{(1UL << GLF_DIRTY), "y" }, \
{(1UL << GLF_LFLUSH), "f" }, \
{(1UL << GLF_INVALIDATE_IN_PROGRESS), "i" }, \
{(1UL << GLF_REPLY_PENDING), "r" }, \
{(1UL << GLF_INITIAL), "I" }, \
{(1UL << GLF_FROZEN), "F" })
every call to glock_trace_name and the call to glock_show_flags resulted in the
string "EX" when I was testing it. With the previous version of my patch where
I did the constant to string conversion with my own function, this didn't happen.
Applying the patch corrects the output, so there is a bug here I think, even if I've
not found the correct fix for it,
Steve.
next prev parent reply other threads:[~2009-06-03 9:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-03 9:05 trace: fix multiple use of __print_flags and __print_symbolic Steven Whitehouse
2009-06-03 9:50 ` Li Zefan
2009-06-03 9:54 ` Steven Whitehouse [this message]
2009-06-03 12:57 ` Steven Whitehouse
2009-06-03 13:23 ` Steven Rostedt
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=1244022889.29604.595.camel@localhost.localdomain \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox