Skip to contentSkip to conversation

PATCH: Fix crash case

PATCH Alan Cox 6 participants 6 messages Aug 16, 2006 – Aug 18, 2006

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

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

kernel/exit.c +2 -1
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
@@ -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);
#1 lore raw
Quoted 3 lines

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

#2 lore raw

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

#3 lore raw
Quoted 6 lines · Nick Warne

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.

Signature · 1 line
~Randy
#4 lore raw
Quoted 9 lines · Randy.Dunlap
Quoted 6 lines

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

Signature · 2 lines
Every program has two purposes:
one for which it was written and another for which it wasn't.
#5 lore raw
In reply to Jan Engelhardt
Quoted 6 lines · Jan Engelhardt
Quoted 2 lines

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