Re: [PATCH] x86/debug: define BUG() againfor !CONFIG_BUG

From: Arnd Bergmann
Date: Thu Mar 30 2017 - 04:03:25 EST


On Thu, Mar 30, 2017 at 9:47 AM, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
>
> * Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>> So should we then, for x86, disable BUG=n instead?
>
> Arnd, does CONFIG_BUG=n give any (marginal) text savings wrt.
> CONFIG_BUG=y && CONFIG_BUG_VERBOSE=n?

My patch makes it slightly worse, but the difference is still
around 1% of the total vmlinux size:

# CONFIG_BUG=n without my patch
text data bss dec hex filename
9543165 4190288 843776 14577229 de6e4d obj-x86/vmlinux

# CONFIG_BUG=n with my patch
text data bss dec hex filename
9578700 4190480 843776 14612956 def9dc obj-x86/vmlinux

# CONFIG_BUG=y, CONFIG_BUGVERBOSE=n
text data bss dec hex filename
9698166 4212208 843776 14754150 e12166 obj-x86/vmlinux

Among the things we save are:

- WARN()/WARN_ON() gets left out entirely
- The bug_entry section (46192 bytes in defconfig)
- The code for decoding and printing the bug

> If not then we should indeed just disable CONFIG_BUG=n.

CONFIG_BUG is already guarded by CONFIG_EXPERT, along with
this help text in Kconfig:

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.

I think this is reasonable to disable for systems that have no console
at all.

Arnd