Skip to content

Commit d20d8e5

Browse files
Vasily GorbikAlexander Gordeev
authored andcommitted
s390/boot: Add bootdebug option to control debug messages
Suppress decompressor debug messages by default, similar to regular kernel debug messages that require 'DEBUG' or 'dyndbg' to be enabled (depending on CONFIG_DYNAMIC_DEBUG). Introduce a 'bootdebug' option to enable printing these messages when needed. All messages are still stored in the boot ring buffer regardless. To enable boot debug messages: bootdebug debug Or combine with 'earlyprintk' to print them without delay: bootdebug debug earlyprintk Signed-off-by: Vasily Gorbik <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent c09f8d0 commit d20d8e5

File tree

5 files changed

+16
-2
lines changed

5 files changed

+16
-2
lines changed

arch/s390/boot/ipl_parm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ void parse_boot_command_line(void)
317317
boot_earlyprintk = true;
318318
if (!strcmp(param, "debug"))
319319
boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
320+
if (!strcmp(param, "bootdebug"))
321+
bootdebug = true;
320322
if (!strcmp(param, "quiet"))
321323
boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET;
322324
if (!strcmp(param, "ignore_loglevel"))

arch/s390/boot/printk.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ bool boot_ignore_loglevel;
1717
char __bootdata(boot_rb)[PAGE_SIZE * 2];
1818
bool __bootdata(boot_earlyprintk);
1919
size_t __bootdata(boot_rb_off);
20+
bool __bootdata(bootdebug);
2021

2122
static void boot_rb_add(const char *str, size_t len)
2223
{
@@ -168,6 +169,9 @@ static void boot_console_earlyprintk(const char *buf)
168169
/* always print emergency messages */
169170
if (level > LOGLEVEL_EMERG && !boot_earlyprintk)
170171
return;
172+
/* print debug messages only when bootdebug is enabled */
173+
if (level == LOGLEVEL_DEBUG && !bootdebug)
174+
return;
171175
if (boot_ignore_loglevel || level < boot_console_loglevel)
172176
sclp_early_printk(printk_skip_level(buf));
173177
}

arch/s390/include/asm/boot_data.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern unsigned long early_ipl_comp_list_size;
1818
extern char boot_rb[PAGE_SIZE * 2];
1919
extern bool boot_earlyprintk;
2020
extern size_t boot_rb_off;
21+
extern bool bootdebug;
2122

2223
#define boot_rb_foreach(cb) \
2324
do { \

arch/s390/kernel/early.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ decompressor_handled_param(facilities);
5050
decompressor_handled_param(nokaslr);
5151
decompressor_handled_param(cmma);
5252
decompressor_handled_param(relocate_lowcore);
53+
decompressor_handled_param(bootdebug);
5354
#if IS_ENABLED(CONFIG_KVM)
5455
decompressor_handled_param(prot_virt);
5556
#endif

arch/s390/kernel/setup.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ struct oldmem_data __bootdata_preserved(oldmem_data);
160160
char __bootdata(boot_rb)[PAGE_SIZE * 2];
161161
bool __bootdata(boot_earlyprintk);
162162
size_t __bootdata(boot_rb_off);
163+
bool __bootdata(bootdebug);
163164

164165
unsigned long __bootdata_preserved(VMALLOC_START);
165166
EXPORT_SYMBOL(VMALLOC_START);
@@ -882,13 +883,18 @@ static void __init log_component_list(void)
882883
}
883884

884885
/*
885-
* Print avoiding interpretation of % in buf
886+
* Print avoiding interpretation of % in buf and taking bootdebug option
887+
* into consideration.
886888
*/
887889
static void __init print_rb_entry(char *buf)
888890
{
889891
char fmt[] = KERN_SOH "0boot: %s";
892+
int level = printk_get_level(buf);
890893

891-
fmt[1] = printk_get_level(buf);
894+
if (level == KERN_DEBUG[1] && !bootdebug)
895+
return;
896+
897+
fmt[1] = level;
892898
printk(fmt, printk_skip_level(buf));
893899
}
894900

0 commit comments

Comments
 (0)