From: Ingo Molnar <mingo@elte.hu>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH for tip][bugfix] ftrace: fix deadlock when setting set_ftrace_pid
Date: Fri, 6 Mar 2009 12:08:00 +0100 [thread overview]
Message-ID: <20090306110800.GF21168@elte.hu> (raw)
In-Reply-To: <49B0C94E.6020300@cn.fujitsu.com>
* Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
> KOSAKI Motohiro wrote:
> > Impact: fix deadlock bug
> >
> > reproduce way:
> > # cd /sys/kernel/debug/tracing
> > # echo $$ > set_ftrace_pid
> >
> > then, console become hangup.
> >
> > detail:
> > when writing set_ftracepid, kernel callstack is following
> >
> > ftrace_pid_write()
> > mutex_lock(&ftrace_lock);
> > ftrace_update_pid_func()
> > mutex_lock(&ftrace_lock);
> > mutex_unlock(&ftrace_lock);
> > mutex_unlock(&ftrace_lock);
> >
> > then, system alaways deadlock when ftrace_pid_write() is called.
> >
> > In past days, ftrace_pid_write() use ftrace_start_lock, but
> > commit e6ea44e9b4c12325337cd1c06103cd515a1c02b2 consolidate
> > ftrace_start_lock to ftrace_lock.
> >
> >
> > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > ---
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 5a3a06b..0d3b393 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -218,10 +218,8 @@ static void ftrace_update_pid_func(void)
> > {
> > ftrace_func_t func;
> >
> > - mutex_lock(&ftrace_lock);
> > -
> > if (ftrace_trace_function == ftrace_stub)
> > - goto out;
> > + return;
> >
> > func = ftrace_trace_function;
> >
> > @@ -238,9 +236,6 @@ static void ftrace_update_pid_func(void)
> > #else
> > __ftrace_trace_function = func;
> > #endif
> > -
> > - out:
> > - mutex_unlock(&ftrace_lock);
> > }
> >
> > /* set when tracing only a pid */
> >
> >
>
> Reviewed-By: Lai Jiangshan <laijs@cn.fujitsu.com>
Applied, thanks!
Ingo
next prev parent reply other threads:[~2009-03-06 11:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-06 6:29 [PATCH for tip][bugfix] ftrace: fix deadlock when setting set_ftrace_pid KOSAKI Motohiro
2009-03-06 6:57 ` Lai Jiangshan
2009-03-06 11:08 ` Ingo Molnar [this message]
2009-03-06 11:09 ` [tip:tracing/ftrace] tracing: " KOSAKI Motohiro
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=20090306110800.GF21168@elte.hu \
--to=mingo@elte.hu \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=srostedt@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.