Re: [patch] change WARN_ON back to "BUG: at ..."

From: Jeremy Fitzhardinge
Date: Thu Dec 21 2006 - 13:49:39 EST


Ingo Molnar wrote:
> Subject: [patch] change WARN_ON back to "BUG: at ..."
> From: Ingo Molnar <mingo@xxxxxxx>
>
> WARN_ON() ever triggering is a kernel bug. Do not try to paper over this
> fact by suggesting to the user that this is 'only' a warning, as the
> following recent commit does:
>
I disagree.

I think there are two issues here: intent and effect.

What's the intent of WARN_ON? Presumably its different from BUG_ON,
otherwise you could just use BUG_ON. Or if not, why not just have
BUG_ON? I think in practice many WARN_ONs are clearly not intended to
be as serious as BUG_ON: they warn about unimplemented things, transient
hiccups, clarifications of errno returns, etc. (Whether WARN_ON is a
good mechanism for all these things is a separate issue.)

Their effects are very different too. The effect of WARN_ON is simply a
message; if I see it in a log, I know that something happened which
should be fixed, but the system is in a fairly sane state. If I see a
BUG_ON, then I know something was killed with extreme prejudice - at
best a process got killed, but there may be stray locks held or other
damage - and the system is basically teetering if it hasn't crashed
already. Because the effects of the two warning mechanisms are so
different, I think its important to make them clearly visually distinct
when scanning the kernel output. My eye is trained to see "BUG: " as
meaning "something destabilizing happened"; if warnings also appear that
way, then it is just needlessly confusing.

J
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/