Skip to content

Commit b2a992a

Browse files
Vasily GorbikAlexander Gordeev
authored andcommitted
s390/boot: Dump message ring buffer on crash with bootdebug
Dump the boot message ring buffer when a crash occurs during boot, but only if bootdebug is enabled. This helps assist in analyzing boot-time issues by providing additional debugging information. Signed-off-by: Vasily Gorbik <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent b79015a commit b2a992a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

arch/s390/boot/boot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ int __printf(1, 2) boot_printk(const char *fmt, ...);
7676
void print_stacktrace(unsigned long sp);
7777
void error(char *m);
7878
int get_random(unsigned long limit, unsigned long *value);
79+
void boot_rb_dump(void);
7980

8081
#ifndef boot_fmt
8182
#define boot_fmt(fmt) fmt

arch/s390/boot/pgm_check_info.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ void print_pgm_check_info(void)
3737
unsigned long *gpregs = (unsigned long *)get_lowcore()->gpregs_save_area;
3838
struct psw_bits *psw = &psw_bits(get_lowcore()->psw_save_area);
3939

40+
if (bootdebug)
41+
boot_rb_dump();
4042
boot_emerg("Linux version %s\n", kernel_version);
4143
if (!is_prot_virt_guest() && early_command_line[0])
4244
boot_emerg("Kernel command line: %s\n", early_command_line);

arch/s390/boot/printk.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ static void boot_rb_add(const char *str, size_t len)
3232
boot_rb_off += len + 1;
3333
}
3434

35+
static void print_rb_entry(const char *str)
36+
{
37+
sclp_early_printk(printk_skip_level(str));
38+
}
39+
40+
static bool debug_messages_printed(void)
41+
{
42+
return boot_earlyprintk && (boot_ignore_loglevel || boot_console_loglevel > LOGLEVEL_DEBUG);
43+
}
44+
45+
void boot_rb_dump(void)
46+
{
47+
if (debug_messages_printed())
48+
return;
49+
sclp_early_printk("Boot messages ring buffer:\n");
50+
boot_rb_foreach(print_rb_entry);
51+
}
52+
3553
const char hex_asc[] = "0123456789abcdef";
3654

3755
static char *as_hex(char *dst, unsigned long val, int pad)

0 commit comments

Comments
 (0)