aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Mackall <mpm@selenic.com>2005-05-01 11:59:01 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:01 -0400
commitc8538a7aa5527d02c7191ac5da124efadf6a2827 (patch)
tree6a2fae8be308d38ed1abe1d5c7539db29238ae61
parente43379f10b42194b8a6e1de342cfb44463c0f6da (diff)
[PATCH] remove all kernel BUGs
This patch eliminates all kernel BUGs, trims about 35k off the typical kernel, and makes the system slightly faster. Signed-off-by: Matt Mackall <mpm@selenic.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/asm-alpha/bug.h3
-rw-r--r--include/asm-arm/bug.h3
-rw-r--r--include/asm-arm26/bug.h3
-rw-r--r--include/asm-frv/bug.h2
-rw-r--r--include/asm-generic/bug.h19
-rw-r--r--include/asm-i386/bug.h5
-rw-r--r--include/asm-ia64/bug.h5
-rw-r--r--include/asm-m68k/bug.h3
-rw-r--r--include/asm-mips/bug.h4
-rw-r--r--include/asm-parisc/bug.h2
-rw-r--r--include/asm-ppc/bug.h3
-rw-r--r--include/asm-ppc64/bug.h7
-rw-r--r--include/asm-s390/bug.h3
-rw-r--r--include/asm-sh/bug.h3
-rw-r--r--include/asm-sparc/bug.h3
-rw-r--r--include/asm-sparc64/bug.h3
-rw-r--r--include/asm-v850/bug.h3
-rw-r--r--include/asm-x86_64/bug.h4
-rw-r--r--init/Kconfig10
-rw-r--r--lib/Kconfig.debug1
20 files changed, 82 insertions, 7 deletions
diff --git a/include/asm-alpha/bug.h b/include/asm-alpha/bug.h
index ae1e0a5fa492..39a3e2a5017d 100644
--- a/include/asm-alpha/bug.h
+++ b/include/asm-alpha/bug.h
@@ -1,6 +1,7 @@
1#ifndef _ALPHA_BUG_H 1#ifndef _ALPHA_BUG_H
2#define _ALPHA_BUG_H 2#define _ALPHA_BUG_H
3 3
4#ifdef CONFIG_BUG
4#include <asm/pal.h> 5#include <asm/pal.h>
5 6
6/* ??? Would be nice to use .gprel32 here, but we can't be sure that the 7/* ??? Would be nice to use .gprel32 here, but we can't be sure that the
@@ -10,6 +11,8 @@
10 : : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__)) 11 : : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__))
11 12
12#define HAVE_ARCH_BUG 13#define HAVE_ARCH_BUG
14#endif
15
13#include <asm-generic/bug.h> 16#include <asm-generic/bug.h>
14 17
15#endif 18#endif
diff --git a/include/asm-arm/bug.h b/include/asm-arm/bug.h
index 5e91b90a8181..24d11672eb60 100644
--- a/include/asm-arm/bug.h
+++ b/include/asm-arm/bug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern volatile void __bug(const char *file, int line, void *data); 8extern volatile void __bug(const char *file, int line, void *data);
8 9
@@ -17,6 +18,8 @@ extern volatile void __bug(const char *file, int line, void *data);
17#endif 18#endif
18 19
19#define HAVE_ARCH_BUG 20#define HAVE_ARCH_BUG
21#endif
22
20#include <asm-generic/bug.h> 23#include <asm-generic/bug.h>
21 24
22#endif 25#endif
diff --git a/include/asm-arm26/bug.h b/include/asm-arm26/bug.h
index 920b70533368..7177c7399967 100644
--- a/include/asm-arm26/bug.h
+++ b/include/asm-arm26/bug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern volatile void __bug(const char *file, int line, void *data); 8extern volatile void __bug(const char *file, int line, void *data);
8/* give file/line information */ 9/* give file/line information */
@@ -12,6 +13,8 @@ extern volatile void __bug(const char *file, int line, void *data);
12#endif 13#endif
13 14
14#define HAVE_ARCH_BUG 15#define HAVE_ARCH_BUG
16#endif
17
15#include <asm-generic/bug.h> 18#include <asm-generic/bug.h>
16 19
17#endif 20#endif
diff --git a/include/asm-frv/bug.h b/include/asm-frv/bug.h
index 011860b28818..074c0d5770eb 100644
--- a/include/asm-frv/bug.h
+++ b/include/asm-frv/bug.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15 15
16#ifdef CONFIG_BUG
16/* 17/*
17 * Tell the user there is some problem. 18 * Tell the user there is some problem.
18 */ 19 */
@@ -45,6 +46,7 @@ do { \
45#define HAVE_ARCH_KGDB_BAD_PAGE 46#define HAVE_ARCH_KGDB_BAD_PAGE
46#define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0) 47#define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0)
47#endif 48#endif
49#endif
48 50
49#include <asm-generic/bug.h> 51#include <asm-generic/bug.h>
50 52
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index e5913c3b715a..6e5aaaa9a2fb 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -4,6 +4,7 @@
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/config.h> 5#include <linux/config.h>
6 6
7#ifdef CONFIG_BUG
7#ifndef HAVE_ARCH_BUG 8#ifndef HAVE_ARCH_BUG
8#define BUG() do { \ 9#define BUG() do { \
9 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 10 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
@@ -31,4 +32,22 @@
31} while (0) 32} while (0)
32#endif 33#endif
33 34
35#else /* !CONFIG_BUG */
36#ifndef HAVE_ARCH_BUG
37#define BUG()
38#endif
39
40#ifndef HAVE_ARCH_PAGE_BUG
41#define PAGE_BUG(page) do { if (page) ; } while (0)
42#endif
43
44#ifndef HAVE_ARCH_BUG_ON
45#define BUG_ON(condition) do { if (condition) ; } while(0)
46#endif
47
48#ifndef HAVE_ARCH_WARN_ON
49#define WARN_ON(condition) do { if (condition) ; } while(0)
50#endif
51#endif
52
34#endif 53#endif
diff --git a/include/asm-i386/bug.h b/include/asm-i386/bug.h
index 706eb511c330..8f79de19eb94 100644
--- a/include/asm-i386/bug.h
+++ b/include/asm-i386/bug.h
@@ -9,6 +9,8 @@
9 * undefined" opcode for parsing in the trap handler. 9 * undefined" opcode for parsing in the trap handler.
10 */ 10 */
11 11
12#ifdef CONFIG_BUG
13#define HAVE_ARCH_BUG
12#ifdef CONFIG_DEBUG_BUGVERBOSE 14#ifdef CONFIG_DEBUG_BUGVERBOSE
13#define BUG() \ 15#define BUG() \
14 __asm__ __volatile__( "ud2\n" \ 16 __asm__ __volatile__( "ud2\n" \
@@ -18,8 +20,7 @@
18#else 20#else
19#define BUG() __asm__ __volatile__("ud2\n") 21#define BUG() __asm__ __volatile__("ud2\n")
20#endif 22#endif
23#endif
21 24
22#define HAVE_ARCH_BUG
23#include <asm-generic/bug.h> 25#include <asm-generic/bug.h>
24
25#endif 26#endif
diff --git a/include/asm-ia64/bug.h b/include/asm-ia64/bug.h
index 2c0cd51e8856..3aa0a0a5474b 100644
--- a/include/asm-ia64/bug.h
+++ b/include/asm-ia64/bug.h
@@ -1,6 +1,7 @@
1#ifndef _ASM_IA64_BUG_H 1#ifndef _ASM_IA64_BUG_H
2#define _ASM_IA64_BUG_H 2#define _ASM_IA64_BUG_H
3 3
4#ifdef CONFIG_BUG
4#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) 5#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
5# define ia64_abort() __builtin_trap() 6# define ia64_abort() __builtin_trap()
6#else 7#else
@@ -8,8 +9,10 @@
8#endif 9#endif
9#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0) 10#define BUG() do { printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); ia64_abort(); } while (0)
10 11
11/* should this BUG should be made generic? */ 12/* should this BUG be made generic? */
12#define HAVE_ARCH_BUG 13#define HAVE_ARCH_BUG
14#endif
15
13#include <asm-generic/bug.h> 16#include <asm-generic/bug.h>
14 17
15#endif 18#endif
diff --git a/include/asm-m68k/bug.h b/include/asm-m68k/bug.h
index 3e1d2266fa69..072ce274d537 100644
--- a/include/asm-m68k/bug.h
+++ b/include/asm-m68k/bug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
7#ifndef CONFIG_SUN3 8#ifndef CONFIG_SUN3
8#define BUG() do { \ 9#define BUG() do { \
@@ -22,6 +23,8 @@
22#endif 23#endif
23 24
24#define HAVE_ARCH_BUG 25#define HAVE_ARCH_BUG
26#endif
27
25#include <asm-generic/bug.h> 28#include <asm-generic/bug.h>
26 29
27#endif 30#endif
diff --git a/include/asm-mips/bug.h b/include/asm-mips/bug.h
index eb94bb96cfbc..3f594b440abc 100644
--- a/include/asm-mips/bug.h
+++ b/include/asm-mips/bug.h
@@ -3,12 +3,14 @@
3 3
4#include <asm/break.h> 4#include <asm/break.h>
5 5
6#ifdef CONFIG_BUG
7#define HAVE_ARCH_BUG
6#define BUG() \ 8#define BUG() \
7do { \ 9do { \
8 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \ 10 __asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \
9} while (0) 11} while (0)
12#endif
10 13
11#define HAVE_ARCH_BUG
12#include <asm-generic/bug.h> 14#include <asm-generic/bug.h>
13 15
14#endif 16#endif
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h
index e72f6e2b4b9f..695588da41f8 100644
--- a/include/asm-parisc/bug.h
+++ b/include/asm-parisc/bug.h
@@ -1,12 +1,14 @@
1#ifndef _PARISC_BUG_H 1#ifndef _PARISC_BUG_H
2#define _PARISC_BUG_H 2#define _PARISC_BUG_H
3 3
4#ifdef CONFIG_BUG
4#define HAVE_ARCH_BUG 5#define HAVE_ARCH_BUG
5#define BUG() do { \ 6#define BUG() do { \
6 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 7 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
7 dump_stack(); \ 8 dump_stack(); \
8 panic("BUG!"); \ 9 panic("BUG!"); \
9} while (0) 10} while (0)
11#endif
10 12
11#include <asm-generic/bug.h> 13#include <asm-generic/bug.h>
12#endif 14#endif
diff --git a/include/asm-ppc/bug.h b/include/asm-ppc/bug.h
index e99c6cb9d618..8b34fd682b0d 100644
--- a/include/asm-ppc/bug.h
+++ b/include/asm-ppc/bug.h
@@ -14,6 +14,7 @@ struct bug_entry {
14 */ 14 */
15#define BUG_WARNING_TRAP 0x1000000 15#define BUG_WARNING_TRAP 0x1000000
16 16
17#ifdef CONFIG_BUG
17#define BUG() do { \ 18#define BUG() do { \
18 __asm__ __volatile__( \ 19 __asm__ __volatile__( \
19 "1: twi 31,0,0\n" \ 20 "1: twi 31,0,0\n" \
@@ -50,6 +51,8 @@ struct bug_entry {
50#define HAVE_ARCH_BUG 51#define HAVE_ARCH_BUG
51#define HAVE_ARCH_BUG_ON 52#define HAVE_ARCH_BUG_ON
52#define HAVE_ARCH_WARN_ON 53#define HAVE_ARCH_WARN_ON
54#endif
55
53#include <asm-generic/bug.h> 56#include <asm-generic/bug.h>
54 57
55#endif 58#endif
diff --git a/include/asm-ppc64/bug.h b/include/asm-ppc64/bug.h
index db31dd22233c..169868fa307d 100644
--- a/include/asm-ppc64/bug.h
+++ b/include/asm-ppc64/bug.h
@@ -26,6 +26,8 @@ struct bug_entry *find_bug(unsigned long bugaddr);
26 */ 26 */
27#define BUG_WARNING_TRAP 0x1000000 27#define BUG_WARNING_TRAP 0x1000000
28 28
29#ifdef CONFIG_BUG
30
29#define BUG() do { \ 31#define BUG() do { \
30 __asm__ __volatile__( \ 32 __asm__ __volatile__( \
31 "1: twi 31,0,0\n" \ 33 "1: twi 31,0,0\n" \
@@ -55,11 +57,12 @@ struct bug_entry *find_bug(unsigned long bugaddr);
55 "i" (__FILE__), "i" (__FUNCTION__)); \ 57 "i" (__FILE__), "i" (__FUNCTION__)); \
56} while (0) 58} while (0)
57 59
58#endif
59
60#define HAVE_ARCH_BUG 60#define HAVE_ARCH_BUG
61#define HAVE_ARCH_BUG_ON 61#define HAVE_ARCH_BUG_ON
62#define HAVE_ARCH_WARN_ON 62#define HAVE_ARCH_WARN_ON
63#endif
64#endif
65
63#include <asm-generic/bug.h> 66#include <asm-generic/bug.h>
64 67
65#endif 68#endif
diff --git a/include/asm-s390/bug.h b/include/asm-s390/bug.h
index 2b8d6d4dffcf..a2e7430aafa6 100644
--- a/include/asm-s390/bug.h
+++ b/include/asm-s390/bug.h
@@ -3,12 +3,15 @@
3 3
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5 5
6#ifdef CONFIG_BUG
6#define BUG() do { \ 7#define BUG() do { \
7 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \ 8 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
8 __asm__ __volatile__(".long 0"); \ 9 __asm__ __volatile__(".long 0"); \
9} while (0) 10} while (0)
10 11
11#define HAVE_ARCH_BUG 12#define HAVE_ARCH_BUG
13#endif
14
12#include <asm-generic/bug.h> 15#include <asm-generic/bug.h>
13 16
14#endif 17#endif
diff --git a/include/asm-sh/bug.h b/include/asm-sh/bug.h
index 70172217140f..70508a360cd6 100644
--- a/include/asm-sh/bug.h
+++ b/include/asm-sh/bug.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/config.h> 4#include <linux/config.h>
5 5
6#ifdef CONFIG_BUG
6/* 7/*
7 * Tell the user there is some problem. 8 * Tell the user there is some problem.
8 */ 9 */
@@ -12,6 +13,8 @@
12} while (0) 13} while (0)
13 14
14#define HAVE_ARCH_BUG 15#define HAVE_ARCH_BUG
16#endif
17
15#include <asm-generic/bug.h> 18#include <asm-generic/bug.h>
16 19
17#endif 20#endif
diff --git a/include/asm-sparc/bug.h b/include/asm-sparc/bug.h
index 0d30a67d87a3..04151208189f 100644
--- a/include/asm-sparc/bug.h
+++ b/include/asm-sparc/bug.h
@@ -1,6 +1,7 @@
1#ifndef _SPARC_BUG_H 1#ifndef _SPARC_BUG_H
2#define _SPARC_BUG_H 2#define _SPARC_BUG_H
3 3
4#ifdef CONFIG_BUG
4/* Only use the inline asm until a gcc release that can handle __builtin_trap 5/* Only use the inline asm until a gcc release that can handle __builtin_trap
5 * -rob 2003-06-25 6 * -rob 2003-06-25
6 * 7 *
@@ -26,6 +27,8 @@ extern void do_BUG(const char *file, int line);
26#endif 27#endif
27 28
28#define HAVE_ARCH_BUG 29#define HAVE_ARCH_BUG
30#endif
31
29#include <asm-generic/bug.h> 32#include <asm-generic/bug.h>
30 33
31#endif 34#endif
diff --git a/include/asm-sparc64/bug.h b/include/asm-sparc64/bug.h
index 25c5b1dfe378..516bb27f3fc4 100644
--- a/include/asm-sparc64/bug.h
+++ b/include/asm-sparc64/bug.h
@@ -1,6 +1,7 @@
1#ifndef _SPARC64_BUG_H 1#ifndef _SPARC64_BUG_H
2#define _SPARC64_BUG_H 2#define _SPARC64_BUG_H
3 3
4#ifdef CONFIG_BUG
4#include <linux/compiler.h> 5#include <linux/compiler.h>
5 6
6#ifdef CONFIG_DEBUG_BUGVERBOSE 7#ifdef CONFIG_DEBUG_BUGVERBOSE
@@ -14,6 +15,8 @@ extern void do_BUG(const char *file, int line);
14#endif 15#endif
15 16
16#define HAVE_ARCH_BUG 17#define HAVE_ARCH_BUG
18#endif
19
17#include <asm-generic/bug.h> 20#include <asm-generic/bug.h>
18 21
19#endif 22#endif
diff --git a/include/asm-v850/bug.h b/include/asm-v850/bug.h
index c778916bf7f2..b0ed2d35f3e8 100644
--- a/include/asm-v850/bug.h
+++ b/include/asm-v850/bug.h
@@ -14,9 +14,12 @@
14#ifndef __V850_BUG_H__ 14#ifndef __V850_BUG_H__
15#define __V850_BUG_H__ 15#define __V850_BUG_H__
16 16
17#ifdef CONFIG_BUG
17extern void __bug (void) __attribute__ ((noreturn)); 18extern void __bug (void) __attribute__ ((noreturn));
18#define BUG() __bug() 19#define BUG() __bug()
19#define HAVE_ARCH_BUG 20#define HAVE_ARCH_BUG
21#endif
22
20#include <asm-generic/bug.h> 23#include <asm-generic/bug.h>
21 24
22#endif /* __V850_BUG_H__ */ 25#endif /* __V850_BUG_H__ */
diff --git a/include/asm-x86_64/bug.h b/include/asm-x86_64/bug.h
index 19aed6e78fec..bdbf66eab6ee 100644
--- a/include/asm-x86_64/bug.h
+++ b/include/asm-x86_64/bug.h
@@ -15,11 +15,13 @@ struct bug_frame {
15 unsigned short line; 15 unsigned short line;
16} __attribute__((packed)); 16} __attribute__((packed));
17 17
18#ifdef CONFIG_BUG
18#define HAVE_ARCH_BUG 19#define HAVE_ARCH_BUG
19#define BUG() \ 20#define BUG() \
20 asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \ 21 asm volatile("ud2 ; .quad %c1 ; .short %c0" :: \
21 "i"(__LINE__), "i" (__stringify(__FILE__))) 22 "i"(__LINE__), "i" (__stringify(__FILE__)))
22void out_of_line_bug(void); 23void out_of_line_bug(void);
23#include <asm-generic/bug.h> 24#endif
24 25
26#include <asm-generic/bug.h>
25#endif 27#endif
diff --git a/init/Kconfig b/init/Kconfig
index abe2682a6ca6..42dca393b94e 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -275,6 +275,16 @@ config KALLSYMS_EXTRA_PASS
275 reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while 275 reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while
276 you wait for kallsyms to be fixed. 276 you wait for kallsyms to be fixed.
277 277
278config BUG
279 bool "BUG() support" if EMBEDDED
280 default y
281 help
282 Disabling this option eliminates support for BUG and WARN, reducing
283 the size of your kernel image and potentially quietly ignoring
284 numerous fatal conditions. You should only consider disabling this
285 option for embedded systems with no facilities for reporting errors.
286 Just say Y.
287
278config BASE_FULL 288config BASE_FULL
279 default y 289 default y
280 bool "Enable full-sized data structures for core" if EMBEDDED 290 bool "Enable full-sized data structures for core" if EMBEDDED
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 426a0cf7b11c..ac23847ce0e3 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -108,6 +108,7 @@ config DEBUG_HIGHMEM
108 108
109config DEBUG_BUGVERBOSE 109config DEBUG_BUGVERBOSE
110 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED 110 bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
111 depends on BUG
111 depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || (X86 && !X86_64) || FRV 112 depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || (X86 && !X86_64) || FRV
112 default !EMBEDDED 113 default !EMBEDDED
113 help 114 help