[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49B0C94E.6020300@cn.fujitsu.com>
Date: Fri, 06 Mar 2009 14:57:18 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
CC: LKML <linux-kernel@...r.kernel.org>,
Steven Rostedt <srostedt@...hat.com>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH for tip][bugfix] ftrace: fix deadlock when setting set_ftrace_pid
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@...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@...fujitsu.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists