2006-08-16 16:14:47

by Alan

[permalink] [raw]
Subject: PATCH: Fix crash case

If we are going to BUG() not panic() here then we should cover the case
of the BUG being compiled out

Signed-off-by: Alan Cox <[email protected]>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.18-rc4-mm1/kernel/exit.c linux-2.6.18-rc4-mm1/kernel/exit.c
--- linux.vanilla-2.6.18-rc4-mm1/kernel/exit.c 2006-08-15 15:40:19.000000000 +0100
+++ linux-2.6.18-rc4-mm1/kernel/exit.c 2006-08-15 16:03:23.000000000 +0100
@@ -979,7 +979,8 @@
schedule();
BUG();
/* Avoid "noreturn function does return". */
- for (;;) ;
+ for (;;)
+ cpu_relax(); /* For when BUG is null */
}

EXPORT_SYMBOL_GPL(do_exit);


2006-08-16 17:40:28

by Jan Engelhardt

[permalink] [raw]
Subject: Re: PATCH: Fix crash case


>If we are going to BUG() not panic() here then we should cover the case
>of the BUG being compiled out

Bug can be compiled out? Ah well I much rather like this patch because of
the previous busy-looping, heating CPUs unnecessarily. (There was a thread,
about that, too.)


Jan Engelhardt
--

2006-08-16 19:10:58

by Nick Warne

[permalink] [raw]
Subject: Re: PATCH: Fix crash case

Sorry for being a noob here - I read LKML to try to learn.

What is meant by 'If we are going to BUG()... cover the case
of the BUG being compiled out'.

What would make BUG(); not being compiled?

Nick

2006-08-16 19:15:43

by Randy Dunlap

[permalink] [raw]
Subject: Re: PATCH: Fix crash case

On Wed, 16 Aug 2006, Nick Warne wrote:

> Sorry for being a noob here - I read LKML to try to learn.
>
> What is meant by 'If we are going to BUG()... cover the case
> of the BUG being compiled out'.
>
> What would make BUG(); not being compiled?

It's a config option is EMBEDDED=y:

config BUG
bool "BUG() support" if EMBEDDED
default y
help
Disabling this option eliminates support for BUG and WARN, reducing
the size of your kernel image and potentially quietly ignoring
numerous fatal conditions. You should only consider disabling this
option for embedded systems with no facilities for reporting errors.
Just say Y.

--
~Randy

2006-08-16 19:19:29

by Nick Warne

[permalink] [raw]
Subject: Re: PATCH: Fix crash case

On Wednesday 16 August 2006 20:15, Randy.Dunlap wrote:

> > Sorry for being a noob here - I read LKML to try to learn.
> >
> > What is meant by 'If we are going to BUG()... cover the case
> > of the BUG being compiled out'.
> >
> > What would make BUG(); not being compiled?
>
> It's a config option is EMBEDDED=y:
>

Ah! That option. OK, thanks.

Nick
--
Every program has two purposes:
one for which it was written and another for which it wasn't.

2006-08-18 09:51:58

by Andi Kleen

[permalink] [raw]
Subject: Re: PATCH: Fix crash case

Jan Engelhardt <[email protected]> writes:

> >If we are going to BUG() not panic() here then we should cover the case
> >of the BUG being compiled out
>
> Bug can be compiled out? Ah well I much rather like this patch because of
> the previous busy-looping, heating CPUs unnecessarily. (There was a thread,
> about that, too.)

cpu_relax() is on most CPUs as busy as a ";". This often annoys me
too (in particular in panic) when the CPU fans spin up and machines
become noisy. Maybe we need a portable halt() macro.

-Andi