Commit 6708948e authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik

s390/early: Dump register contents and call trace for early crashes

If the early program check handler cannot resolve a program check dump
register contents and a call trace to the console before loading a disabled
wait psw. This makes debugging much easier.

Emit an extra message with early_printk() for cases where regular printk()
via the early console is not yet working so that at least some information
is available.
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Acked-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 0bc6a69f
......@@ -115,6 +115,8 @@ extern unsigned int console_irq;
#define SET_CONSOLE_VT220 do { console_mode = 4; } while (0)
#define SET_CONSOLE_HVC do { console_mode = 5; } while (0)
void register_early_console(void);
#ifdef CONFIG_VMCP
void vmcp_cma_reserve(void);
#else
......
......@@ -7,6 +7,7 @@
#define KMSG_COMPONENT "setup"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/sched/debug.h>
#include <linux/compiler.h>
#include <linux/init.h>
#include <linux/errno.h>
......@@ -191,6 +192,15 @@ void __init __do_early_pgm_check(struct pt_regs *regs)
}
if (fixup_exception(regs))
return;
/*
* Unhandled exception - system cannot continue but try to get some
* helpful messages to the console. Use early_printk() to print
* some basic information in case it is too early for printk().
*/
register_early_console();
early_printk("PANIC: early exception %04x PSW: %016lx %016lx\n",
regs->int_code & 0xffff, regs->psw.mask, regs->psw.addr);
show_regs(regs);
disabled_wait();
}
......
......@@ -6,6 +6,7 @@
#include <linux/console.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/sclp.h>
static void sclp_early_write(struct console *con, const char *s, unsigned int len)
......@@ -20,6 +21,16 @@ static struct console sclp_early_console = {
.index = -1,
};
void __init register_early_console(void)
{
if (early_console)
return;
if (!sclp.has_linemode && !sclp.has_vt220)
return;
early_console = &sclp_early_console;
register_console(early_console);
}
static int __init setup_early_printk(char *buf)
{
if (early_console)
......@@ -27,10 +38,7 @@ static int __init setup_early_printk(char *buf)
/* Accept only "earlyprintk" and "earlyprintk=sclp" */
if (buf && !str_has_prefix(buf, "sclp"))
return 0;
if (!sclp.has_linemode && !sclp.has_vt220)
return 0;
early_console = &sclp_early_console;
register_console(early_console);
register_early_console();
return 0;
}
early_param("earlyprintk", setup_early_printk);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment