public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Frédéric Weisbecker" <fweisbec@gmail.com>
Subject: Re: [PATCH][git pull] tracing: limit the number of loops the ring buffer self test can make
Date: Thu, 19 Feb 2009 10:23:48 +0100	[thread overview]
Message-ID: <20090219092348.GD2354@elte.hu> (raw)
In-Reply-To: <alpine.DEB.1.10.0902182254570.30122@gandalf.stny.rr.com>


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
> 
> I added one more fix. Thinking about the solution, although 
> the disabling of the ring buffer is good enough to prevent the 
> bug you hit. I became worried about a corrupted ring buffer 
> that can cause an inifinite loop. This patch adds a fix for 
> that too.

yes, that's a good idea too:

> @@ -23,10 +23,20 @@ static int trace_test_buffer_cpu(struct trace_array *tr, int cpu)
>  {
>  	struct ring_buffer_event *event;
>  	struct trace_entry *entry;
> +	unsigned int loops = 0;
>  
>  	while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) {
>  		entry = ring_buffer_event_data(event);
>  
> +		/*
> +		 * The ring buffer is a size of trace_buf_size, if
> +		 * we loop more than the size, there's something wrong
> +		 * with the ring buffer.
> +		 */
> +		if (loops++ > trace_buf_size) {
> +			printk(KERN_CONT ".. bad ring buffer ");
> +			goto failed;
> +		}

Would be nice to also emit a WARN_ONCE() message about the test 
failure, to make sure automated tests like mine pick even 
soft-failures up.

	Ingo

  reply	other threads:[~2009-02-19  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19  3:57 [PATCH][git pull] tracing: limit the number of loops the ring buffer self test can make Steven Rostedt
2009-02-19  9:23 ` Ingo Molnar [this message]
2009-02-19 18:08   ` Steven Rostedt

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=20090219092348.GD2354@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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