linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: fix circular dead lock
Date: Tue, 02 Feb 2010 08:25:35 -0500	[thread overview]
Message-ID: <1265117135.4561.12092.camel@frodo> (raw)
In-Reply-To: <4B67D4F9.9080905@cn.fujitsu.com>

On Tue, 2010-02-02 at 15:32 +0800, Lai Jiangshan wrote:
> When we cat <debugfs>/tracing/stack_trace, we may cause circular lock:
> sys_read()
>   t_start()
>      arch_spin_lock(&max_stack_lock);
> 
>   t_show()
>      seq_printf(), vsnprintf() .... /* they are all trace-able,
>        when they are traced, max_stack_lock may be required again. */
> 
> 
> The following script can trigger this circular dead lock very easy:
> #!/bin/bash
> 
> echo 1 > /proc/sys/kernel/stack_tracer_enabled
> 
> mount -t debugfs xxx /mnt > /dev/null 2>&1

> (
> # make check_stack() zealous to require max_stack_lock
> for ((; ;))
> {
> 	echo 1 > /mnt/tracing/stack_max_size
> }
> ) &
> 
> for ((; ;))
> {
> 	cat /mnt/tracing/stack_trace > /dev/null
> }
> 
> 
> To fix this bug, we increase the percpu trace_active before
> require the lock.
> 
> Reported-by: Li Zefan <lizf@cn.fujitsu.com>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>

Thanks Lai! I'll try to get this into 33.

-- Steve



  reply	other threads:[~2010-02-02 13:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02  7:32 [PATCH] tracing: fix circular dead lock Lai Jiangshan
2010-02-02 13:25 ` Steven Rostedt [this message]
2010-02-03  5:18 ` [tip:tracing/urgent] tracing: Fix circular dead lock in stack trace tip-bot for Lai Jiangshan

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=1265117135.4561.12092.camel@frodo \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).