summaryrefslogtreecommitdiff
path: root/arch/s390
diff options
context:
space:
mode:
authorVasily Gorbik <gor@linux.ibm.com>2024-11-21 00:23:48 +0300
committerAlexander Gordeev <agordeev@linux.ibm.com>2025-01-26 19:24:01 +0300
commitd20d8e51338fc39aedf98786a4e9b71d4af4bda7 (patch)
treeaba7ebf2af9eaa89c6197df6c5d3c610a22897db /arch/s390
parentc09f8d0ad673afdfd5d097d95d2026a84fa4926e (diff)
downloadlinux-d20d8e51338fc39aedf98786a4e9b71d4af4bda7.tar.xz
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 <gor@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/boot/ipl_parm.c2
-rw-r--r--arch/s390/boot/printk.c4
-rw-r--r--arch/s390/include/asm/boot_data.h1
-rw-r--r--arch/s390/kernel/early.c1
-rw-r--r--arch/s390/kernel/setup.c10
5 files changed, 16 insertions, 2 deletions
diff --git a/arch/s390/boot/ipl_parm.c b/arch/s390/boot/ipl_parm.c
index fd4874ab30cb..397046f0c1df 100644
--- a/arch/s390/boot/ipl_parm.c
+++ b/arch/s390/boot/ipl_parm.c
@@ -317,6 +317,8 @@ void parse_boot_command_line(void)
boot_earlyprintk = true;
if (!strcmp(param, "debug"))
boot_console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
+ if (!strcmp(param, "bootdebug"))
+ bootdebug = true;
if (!strcmp(param, "quiet"))
boot_console_loglevel = CONSOLE_LOGLEVEL_QUIET;
if (!strcmp(param, "ignore_loglevel"))
diff --git a/arch/s390/boot/printk.c b/arch/s390/boot/printk.c
index 7b7203f078c8..4c60245697ab 100644
--- a/arch/s390/boot/printk.c
+++ b/arch/s390/boot/printk.c
@@ -17,6 +17,7 @@ bool boot_ignore_loglevel;
char __bootdata(boot_rb)[PAGE_SIZE * 2];
bool __bootdata(boot_earlyprintk);
size_t __bootdata(boot_rb_off);
+bool __bootdata(bootdebug);
static void boot_rb_add(const char *str, size_t len)
{
@@ -168,6 +169,9 @@ static void boot_console_earlyprintk(const char *buf)
/* always print emergency messages */
if (level > LOGLEVEL_EMERG && !boot_earlyprintk)
return;
+ /* print debug messages only when bootdebug is enabled */
+ if (level == LOGLEVEL_DEBUG && !bootdebug)
+ return;
if (boot_ignore_loglevel || level < boot_console_loglevel)
sclp_early_printk(printk_skip_level(buf));
}
diff --git a/arch/s390/include/asm/boot_data.h b/arch/s390/include/asm/boot_data.h
index e7ef7524b847..da5527c50738 100644
--- a/arch/s390/include/asm/boot_data.h
+++ b/arch/s390/include/asm/boot_data.h
@@ -18,6 +18,7 @@ extern unsigned long early_ipl_comp_list_size;
extern char boot_rb[PAGE_SIZE * 2];
extern bool boot_earlyprintk;
extern size_t boot_rb_off;
+extern bool bootdebug;
#define boot_rb_foreach(cb) \
do { \
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index 62f8f5a750a3..4cdf3bf33052 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -50,6 +50,7 @@ decompressor_handled_param(facilities);
decompressor_handled_param(nokaslr);
decompressor_handled_param(cmma);
decompressor_handled_param(relocate_lowcore);
+decompressor_handled_param(bootdebug);
#if IS_ENABLED(CONFIG_KVM)
decompressor_handled_param(prot_virt);
#endif
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index feff1bb9ac2d..dd0979182890 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -160,6 +160,7 @@ struct oldmem_data __bootdata_preserved(oldmem_data);
char __bootdata(boot_rb)[PAGE_SIZE * 2];
bool __bootdata(boot_earlyprintk);
size_t __bootdata(boot_rb_off);
+bool __bootdata(bootdebug);
unsigned long __bootdata_preserved(VMALLOC_START);
EXPORT_SYMBOL(VMALLOC_START);
@@ -882,13 +883,18 @@ static void __init log_component_list(void)
}
/*
- * Print avoiding interpretation of % in buf
+ * Print avoiding interpretation of % in buf and taking bootdebug option
+ * into consideration.
*/
static void __init print_rb_entry(char *buf)
{
char fmt[] = KERN_SOH "0boot: %s";
+ int level = printk_get_level(buf);
- fmt[1] = printk_get_level(buf);
+ if (level == KERN_DEBUG[1] && !bootdebug)
+ return;
+
+ fmt[1] = level;
printk(fmt, printk_skip_level(buf));
}