From: Arnd Bergmann <arnd@arndb.de>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family
Date: Mon, 24 Feb 2014 10:35:09 +0100 [thread overview]
Message-ID: <22118516.b9uAkaIibl@wuerfel> (raw)
In-Reply-To: <20140224084437.GG20680@thin>
On Monday 24 February 2014 00:44:37 Josh Triplett wrote:
>
> I agree that allowing BUG() to become a no-op seems suboptimal, if only
> because of the resulting warnings and mis-optimizations. However, I
> think the overhead could be cut down massively, such that BUG() just
> compiles down to a one-byte undefined instruction. (__builtin_trap()
> might do the right thing here; worth checking.)
__builtin_trap() sounds great. Is that available on all supported
architectures and gcc versions?
> In any case, while I agree that the change you're proposing seems
> reasonable, I don't think it should occur as part of this patch. Do you
> think this patch seems reasonable, and that further patches could occur
> on top of it for the behavior you describe?
Yes, that's probably fine. I was hoping I could get you to address
both issues at once, but they are really different as you say, and
I'm pretty sure that applying my patch wouldn't change much regarding
the benifit of yours in terms of object code size changes.
One thing that would make it slightly easier for me later though:
> +#define WARN_ON_ONCE(condition) WARN_ON(condition)
> +#define WARN_ONCE(condition, format...) WARN_ON(condition)
> +#define WARN_TAINT(condition, taint, format...) WARN_ON(condition)
> +#define WARN_TAINT_ONCE(condition, taint, format...) WARN_ON(condition)
Can you change those that come with a format to call WARN() rather than
WARN_ON()?
> > FWIW, there is an easy extension to this to get rid of some "unused variable"
> > warnings, but using the format string in an unreachable part of the macro,
> > as I did in my patch (but didn't explain there):
> >
> > @@ -125,6 +126,8 @@ extern void warn_slowpath_null(const char *file, const int line);
> > #ifndef WARN
> > #define WARN(condition, format...) ({ \
> > int __ret_warn_on = !!(condition); \
> > + if (0 && (__ret_warn_on)) \
> > + printk(format); \
> > unlikely(__ret_warn_on); \
> > })
> > #endif
>
> This seems better done via no_printk, but yes, that seems sensible.
> The arguments should be used too.
>
> (But again, I'm not actually changing these in this patch; diff just
> thinks I'm moving them.)
I understand. It's also unrelated to what I was doing in my patch.
Do you mind adding a second patch on top of yours to do no_printk()
here? It's a trivial change and since you're touching that code already
I think it makes sense to keep it with your series, even if it comes
as a second patch.
Arnd
next prev parent reply other threads:[~2014-02-24 9:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-22 19:23 [PATCH RESEND] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family Josh Triplett
2014-02-22 19:23 ` Josh Triplett
2014-02-22 21:54 ` Randy Dunlap
2014-02-22 22:31 ` Josh Triplett
2014-02-22 22:36 ` Josh Triplett
2014-02-24 8:02 ` Arnd Bergmann
2014-02-24 8:02 ` Arnd Bergmann
2014-02-24 8:44 ` Josh Triplett
2014-02-24 8:44 ` Josh Triplett
2014-02-24 9:35 ` Arnd Bergmann [this message]
2014-02-24 12:09 ` David Howells
2014-02-24 12:42 ` Arnd Bergmann
2014-02-24 13:16 ` One Thousand Gnomes
2014-02-24 13:39 ` Arnd Bergmann
2014-02-24 23:17 ` Andrew Morton
2014-02-24 23:17 ` Andrew Morton
2014-02-25 3:06 ` Josh Triplett
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=22118516.b9uAkaIibl@wuerfel \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=josh@joshtriplett.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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