Re: [PATCH 17/17] RISC-V: Build Infastructure

From: Palmer Dabbelt
Date: Tue Jul 11 2017 - 12:22:48 EST


On Mon, 10 Jul 2017 23:31:18 PDT (-0700), mpe@xxxxxxxxxxxxxx wrote:
> Palmer Dabbelt <palmer@xxxxxxxxxxx> writes:
>
>> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
>> new file mode 100644
>> index 000000000000..366f5f2cf106
>> --- /dev/null
>> +++ b/arch/riscv/Kconfig
>> @@ -0,0 +1,294 @@
> ...
>> +
>> +config EARLY_PRINTK
>> + bool "Early printk"
>> + default n
>> + help
>> + This option enables special console drivers which allow the kernel
>> + to print messages very early in the bootup process.
>> +
>> + This is useful for kernel debugging when your machine crashes very
>> + early before the console code is initialized. For normal operation
>> + it is not recommended because it looks ugly and doesn't cooperate
>> + with klogd/syslogd or the X server. You should normally N here,
>> + unless you want to debug such a crash.
>
> Looks like you copied this text from x86? I think the comment about it
> being ugly refers to the VGA early console which you don't have, so
> that's not really accurate.
>
> And the part about it not cooperating with klogs/syslogd is true, early
> printk output doesn't go to syslog. But if you turn EARLY_PRINTK off
> then early printk output goes nowhere at all:
>
> #ifdef CONFIG_EARLY_PRINTK
> extern asmlinkage __printf(1, 2)
> void early_printk(const char *fmt, ...);
> #else
> static inline __printf(1, 2) __cold
> void early_printk(const char *s, ...) { }
> #endif
>
>
> So if you have a functional early console (which I think you do) then
> you might be better off just making this def_bool y.

I think that's best. The SBI's EARLY_PRINTK support is quite clean, so I don't
see any reason to disable it. How does this look?

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 366f5f2cf106..cc274bbc29a7 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -268,18 +268,7 @@ config CMDLINE_OVERRIDE
If you don't know what to do here, say N.

config EARLY_PRINTK
- bool "Early printk"
- default n
- help
- This option enables special console drivers which allow the kernel
- to print messages very early in the bootup process.
-
- This is useful for kernel debugging when your machine crashes very
- early before the console code is initialized. For normal operation
- it is not recommended because it looks ugly and doesn't cooperate
- with klogd/syslogd or the X server. You should normally N here,
- unless you want to debug such a crash.
-
+ def_bool y

source "lib/Kconfig.debug"