From: Michael Buesch <mbuesch@freenet.de>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: Albert Cahalan <albert@users.sf.net>,
Albert Cahalan <albert@users.sourceforge.net>,
axboe@suse.de, bunk@fs.tum.de, Linus Torvalds <torvalds@osdl.org>,
arjanv@redhat.com,
linux-kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: What policy for BUG_ON()?
Date: Wed, 1 Sep 2004 00:16:30 +0200 [thread overview]
Message-ID: <200409010016.36570.mbuesch@freenet.de> (raw)
In-Reply-To: <F8184F90-FB94-11D8-9B58-000393ACC76E@mac.com>
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
Quoting Kyle Moffett <mrmacman_g4@mac.com>:
> Then in most cases new statements would use BUG_CHECK, especially if
> they contain expensive unnecessary function calls or critical sections.
>
> This would break the least amount of existing code, and provide both
> methods to kernel developers.
So, back to the real world. ;)
- Where do we insert BUG_ON()s?
Only in places, where we are going to crash or corrupt data soon.
- Do we insert "expensive unnecessary function calls" in a BUG_ON()?
No we don't. Could you give a good example, which
needs an expensive call inside a BUG_ON()?
In a shiny good world we expect BUG()s to never trigger. So I think
it's a bit crazy to check for things that theoretically can't happen
and waste tons of CPU cycles for this, with expensive calls.
If we really want to check this while debugging, I think we
should explicitely honor the DEBUG define in the code and have
our own debug printk() that shows the mess.
I think here's a general confusion about what BUG_ON() is intended
for. I think (I'm not the author of it, so I can't say 100%. :) )
it is _not_ for debugging while development. It is for checking unpossible
things, that blow up the whole machine if they trigger nevertheless.
So I think it's wrong to let BUG_ON() depend on a DEBUG define, because
DEBUG is, by definition, not enabled in the kernels people use.
But I think we _want_ that people evaluate the BUG_ON()s.
I'm not talking of embedded systems, etc... .
--
Regards Michael Buesch [ http://www.tuxsoft.de.vu ]
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2004-08-31 22:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-31 15:06 What policy for BUG_ON()? Albert Cahalan
2004-08-31 16:52 ` Linus Torvalds
2004-08-31 17:39 ` Albert Cahalan
2004-08-31 21:30 ` Kyle Moffett
2004-08-31 22:16 ` Michael Buesch [this message]
2004-08-31 23:32 ` Kyle Moffett
-- strict thread matches above, loose matches on Subject: below --
2004-08-30 20:15 Adrian Bunk
2004-08-30 20:22 ` Arjan van de Ven
2004-08-31 6:28 ` Jens Axboe
2004-08-31 11:14 ` Paulo Marques
2004-08-31 0:25 ` Linus Torvalds
2004-08-31 11:28 ` Adrian Bunk
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=200409010016.36570.mbuesch@freenet.de \
--to=mbuesch@freenet.de \
--cc=albert@users.sf.net \
--cc=albert@users.sourceforge.net \
--cc=arjanv@redhat.com \
--cc=axboe@suse.de \
--cc=bunk@fs.tum.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mrmacman_g4@mac.com \
--cc=torvalds@osdl.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