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: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ringbuffer: synchronize for resizing
Date: Tue, 03 Nov 2009 10:35:40 -0500	[thread overview]
Message-ID: <1257262540.26028.3336.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4AF01735.9060409@cn.fujitsu.com>


On Tue, 2009-11-03 at 19:42 +0800, Lai Jiangshan wrote:
> We got a sudden panic when we reduced the size of the
> ringbuffer.
> 
> We can reproduce the panic by the following steps:
> 
> echo 1 > events/sched/enable
> cat trace_pipe > /dev/null &
> 
> while ((1))
> do
> echo 12000 > buffer_size_kb
> echo 512 > buffer_size_kb
> done
> 
> (not more than 5 seconds, panic ...)

Thanks! I'll push this out for inclusion right away.

-- Steve

> 
> Reported-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index 63446f1..db223fe 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -1196,6 +1196,7 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages)
>  	atomic_inc(&cpu_buffer->record_disabled);
>  	synchronize_sched();
>  
> +	spin_lock_irq(&cpu_buffer->reader_lock);
>  	rb_head_page_deactivate(cpu_buffer);
>  
>  	for (i = 0; i < nr_pages; i++) {
> @@ -1210,6 +1211,7 @@ rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned nr_pages)
>  		return;
>  
>  	rb_reset_cpu(cpu_buffer);
> +	spin_unlock_irq(&cpu_buffer->reader_lock);
>  
>  	rb_check_pages(cpu_buffer);
>  
> 
> 
> 


  reply	other threads:[~2009-11-03 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03 11:42 Lai Jiangshan
2009-11-03 15:35 ` Steven Rostedt [this message]
2009-11-04 11:09 ` [tip:tracing/urgent] ring-buffer: Synchronize resizing buffer with reader lock 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=1257262540.26028.3336.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®