From: Ingo Molnar <mingo@elte.hu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 2/2] ring-buffer: replace most bug ons with warn on and disable buffer
Date: Tue, 11 Nov 2008 10:09:15 +0100 [thread overview]
Message-ID: <20081111090915.GA14165@elte.hu> (raw)
In-Reply-To: <20081111041209.104332033@goodmis.org>
* Steven Rostedt <rostedt@goodmis.org> wrote:
> +#define RB_WARN_ON_RET_INT(buffer, cond) \
> + do { \
> + if (unlikely(cond)) { \
> + atomic_inc(&buffer->record_disabled); \
> + WARN_ON(1); \
> return -1; \
> } \
btw., the _RET() methods are rather ugly as they include an implicit
code flow change (a 'return' statement).
Please change it to a more readable form that preserves the code flow,
something like:
if (RB_WARN_ON(buffer, cond))
return -1;
See kernel/lockdep.c about how to do this cleanly: introduce a
_single_ global "oh, we are broken" flag which is increased once and
never decreased again.
In the case of lockdep that's the debug_locks flag. It's used in
various code-flow-preserving forms of debug checks:
...
if (DEBUG_LOCKS_WARN_ON(depth >= 20))
return;
...
if (!debug_locks_off_graph_unlock())
return NULL;
...
if (!debug_locks_off_graph_unlock())
return 0;
...
if (!__raw_spin_is_locked(&lockdep_lock))
return DEBUG_LOCKS_WARN_ON(1);
etc.
Ingo
next prev parent reply other threads:[~2008-11-11 9:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-11 4:11 [PATCH 0/2] ftrace: updates for linux-tip Steven Rostedt
2008-11-11 4:11 ` [PATCH 1/2] ftrace: prevent ftrace_special from recursion Steven Rostedt
2008-11-11 4:11 ` [PATCH 2/2] ring-buffer: replace most bug ons with warn on and disable buffer Steven Rostedt
2008-11-11 9:09 ` Ingo Molnar [this message]
2008-11-11 8:52 ` [PATCH 0/2] ftrace: updates for linux-tip Ingo Molnar
2008-11-11 9:02 ` 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=20081111090915.GA14165@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
/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