public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH 1/5] tracing: Prevent kernel oops with corrupted buffer
Date: Tue, 26 Jan 2010 23:39:02 +0100	[thread overview]
Message-ID: <20100126223900.GA5223@nowhere> (raw)
In-Reply-To: <20100126143223.e4332098.akpm@linux-foundation.org>

On Tue, Jan 26, 2010 at 02:32:23PM -0800, Andrew Morton wrote:
> > +	if (WARN_ON_ONCE(pid < 0)) {
> > +		strcpy(comm, "<XXX>");
> > +		return;
> > +	}
> > +
> >  	if (pid > PID_MAX_DEFAULT) {
> >  		strcpy(comm, "<...>");
> >  		return;
> 
> But why is it WARN_ON_ONCE()?  That will only fix the problem a single
> time.  On the second occurrence, it will oops again.



The warning will be produced only once, but after that,
the condition is still checked like a simple if:

#define WARN_ON_ONCE(condition)	({				\
	static bool __warned;					\
	int __ret_warn_once = !!(condition);			\
								\
	if (unlikely(__ret_warn_once))				\
		if (WARN_ON(!__warned)) 			\
			__warned = true;			\
	unlikely(__ret_warn_once);				\
})


And since this function can be called anytime we have a trace
to print to the user, we don't want to encumber with thousands
of warnings.


  reply	other threads:[~2010-01-26 22:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-26 22:09 [PATCH 0/5][GIT PULL][v2.6.33] tracing: fixes and documentation updates Steven Rostedt
2010-01-26 22:09 ` [PATCH 1/5] tracing: Prevent kernel oops with corrupted buffer Steven Rostedt
2010-01-26 22:32   ` Andrew Morton
2010-01-26 22:39     ` Frederic Weisbecker [this message]
2010-01-26 23:20       ` Steven Rostedt
2010-01-26 23:24     ` Steven Rostedt
2010-01-26 22:09 ` [PATCH 2/5] ring-buffer: Check if ring buffer iterator has stale data Steven Rostedt
2010-01-26 22:09 ` [PATCH 3/5] ring-buffer: Check for end of page in iterator Steven Rostedt
2010-01-26 22:09 ` [PATCH 4/5] tracing/documentation: Fix a typo in ftrace.txt Steven Rostedt
2010-01-26 22:09 ` [PATCH 5/5] tracing/documentation: Cover new frame pointer semantics Steven Rostedt
2010-01-27  9:37 ` [PATCH 0/5][GIT PULL][v2.6.33] tracing: fixes and documentation updates Ingo Molnar

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=20100126223900.GA5223@nowhere \
    --to=fweisbec@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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