From: Ingo Molnar <mingo@elte.hu>
To: David Howells <dhowells@redhat.com>
Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/7] Add conditional oopsing with annotation
Date: Sun, 18 Dec 2011 09:02:05 +0100 [thread overview]
Message-ID: <20111218080205.GA4144@elte.hu> (raw)
In-Reply-To: <20111216141357.24668.49793.stgit@warthog.procyon.org.uk>
* David Howells <dhowells@redhat.com> wrote:
> This facility can be made use of by one of:
>
> ANNOTATED_BUG(const char *fmt, ...);
> ANNOTATED_BUG_ON(bool condition, const char *fmt, ...);
Hm, what about WARN_ON()s?
WARN_ON() and WARN_ON_ONCE() covers like 99% of the *actual*
bugreports we get: we are actively getting rid of BUG()s that do
trigger and are asking all new patches to come with WARN_ON()s.
BUG()s are generally a poor way of reporting bugs.
Another, much bigger issue is the actual syntax:
> - BUG_ON(atomic_read(&cookie->usage) <= 0);
> + ASSERTCMP(atomic_read(&cookie->usage), >, 0);
NAK on that concept on two grounds!
1) BUG_ON() is a well-known pattern. Changing it to the inverted
assert() braindamage is going to cause confusion years down
the road. Years ago we've settled on using BUG*() and WARN*()
assertions to include conditions that check the 'bad'
condition'. assert() covers the negated 'good' condition -
which works but the two are truly awful when mixed.
2) The '>,0' syntax is ugly.
Why don't we simply extend the *existing* primitives with a
'verbose' variant that saves the text string of the macro using
the '#param' syntax, intead of modifying the usage sites with a
pointless splitting along logical ops?
Doing that would also remove the rather pointess ANNOTATED_()
prefix, which is like totally uninteresting in the actual usage
sites. WARN()s want to be as short, obvious and low-profile as
possible.
So the whole schizophrenic split between BUG_ON()/WARN_ON() and
the assert() world is nonsensical and confusing - we should
settle on *one* logical variant to make code reading easier. And
i thought in the kernel we already settled on one of these
variants and are using it almost exclusively ...
So this series does not look good enough to me yet.
Thanks,
Ingo
next prev parent reply other threads:[~2011-12-18 8:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 14:13 [PATCH 1/7] Add conditional oopsing with annotation David Howells
2011-12-16 14:14 ` [PATCH 2/7] Make shrink_dcache_for_umount_subtree() use ANNOTATED_BUG() David Howells
2011-12-16 14:14 ` [PATCH 3/7] Add assertion checking macros David Howells
2011-12-16 14:14 ` David Howells
2011-12-16 21:36 ` Andi Kleen
2011-12-20 15:38 ` David Howells
2011-12-16 14:14 ` [PATCH 4/7] FS-Cache: Use new core assertion macros David Howells
2011-12-16 14:14 ` [PATCH 5/7] CacheFiles: " David Howells
2011-12-16 14:14 ` [PATCH 6/7] AFS: " David Howells
2011-12-16 14:14 ` David Howells
2011-12-16 14:14 ` [PATCH 7/7] RxRPC: " David Howells
2011-12-16 14:14 ` David Howells
2011-12-17 19:15 ` [PATCH 1/7] Add conditional oopsing with annotation Mike Frysinger
2011-12-17 19:15 ` Mike Frysinger
2011-12-18 8:02 ` Ingo Molnar [this message]
2011-12-20 15:34 ` David Howells
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=20111218080205.GA4144@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).