mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Li Zefan <lizf@cn.fujitsu.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] WARNING: at kernel/trace/ring_buffer.c:3420
Date: Mon, 08 Mar 2010 10:03:16 -0500	[thread overview]
Message-ID: <1268060596.10871.1805.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4B949E43.2010906@cn.fujitsu.com>

On Mon, 2010-03-08 at 14:50 +0800, Lai Jiangshan wrote:
> Li Zefan wrote:
> > While running a ftrace test, a kernel warning showed up. The bug is not so
> > easy to reproduce, normally it takes 30 mins to 2 hours.
> > 
> > After revering 3c05d7482777f15e71bb4cb1ba78dee2800dfec6, I ran the test
> > for 15 hours, and the bug seems disapeared.
> > 
> 
> This bug exhausted us, we found a issue: a tiny window which is
> one of causes of this bug. This patch is to close this tiny window.
> (bug is not fixed)
> 
> From: Lai Jiangshan <laijs@cn.fujitsu.com>
> 
> ringbuffer resizing and reseting will increase the ->record_disabled
> and then wait until a rcu_shced grace period passes.
> 
> Contrarily, testing ->record_disabled should be at the same
> preempt disabled critical region as writing into ringbuffer, otherwise
> it will leave a window break ringbuffer resizing or reseting.

So the resizing and the resetting need a synchronize_sched() after the
disabling of the buffers, right?

-- Steve

> 
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> Reported-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 8c1b2d2..54191d6 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -2232,12 +2232,12 @@ ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length)
>  	if (ring_buffer_flags != RB_BUFFERS_ON)
>  		return NULL;
>  
> -	if (atomic_read(&buffer->record_disabled))
> -		return NULL;
> -
>  	/* If we are tracing schedule, we don't want to recurse */
>  	resched = ftrace_preempt_disable();
>  
> +	if (atomic_read(&buffer->record_disabled))
> +		goto out_nocheck;
> +
>  	if (trace_recursive_lock())
>  		goto out_nocheck;
>  
> @@ -2469,11 +2469,11 @@ int ring_buffer_write(struct ring_buffer *buffer,
>  	if (ring_buffer_flags != RB_BUFFERS_ON)
>  		return -EBUSY;
>  
> -	if (atomic_read(&buffer->record_disabled))
> -		return -EBUSY;
> -
>  	resched = ftrace_preempt_disable();
>  
> +	if (atomic_read(&buffer->record_disabled))
> +		goto out;
> +
>  	cpu = raw_smp_processor_id();
>  
>  	if (!cpumask_test_cpu(cpu, buffer->cpumask))
> 
> 



  reply	other threads:[~2010-03-08 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-08  6:04 Li Zefan
2010-03-08  6:50 ` Lai Jiangshan
2010-03-08 15:03   ` Steven Rostedt [this message]
2010-03-08 15:07     ` Steven Rostedt
2010-03-09  3:35       ` Lai Jiangshan
2010-03-09  3:54         ` Steven Rostedt
2010-03-09 17:28         ` Steven Rostedt
2010-03-09 18:46           ` Steven Rostedt
2010-03-13 12:24   ` [tip:tracing/urgent] ring-buffer: Move disabled check into preempt disable section tip-bot for Lai Jiangshan
2010-03-08 14:54 ` [BUG] WARNING: at kernel/trace/ring_buffer.c:3420 Steven Rostedt
2010-03-09  1:08   ` Li Zefan

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=1268060596.10871.1805.camel@gandalf.stny.rr.com \
    --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

all inboxes | Powered by JetHome®