[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] How to display dom0 kernel printk on hvc0
On Thu, 7 Aug 2014, manish jaggi wrote: > Hi Stefano, > > I am debugging a kernel crash when I start xencommons. If I add prints in > kernel the prints are only visible in > dmesg and not on dom0 console. This makes it difficult to view kernel printks > at the time of crash. > > I tried xen_raw_printks but the print only comes when you press a key, so > while a crash is happening you cannot > press a key. > > Is there a way to enable printks on hvc0Â > OR > is there a way to dump __logbuf of linux from xen shell. You can hack printk and/or early_printk so that everything will go via the Xen console, see below. Of course this is very hacky, don't tell anybody that I wrote this patch ;-) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c index 2dc36d0..38bcf29 100644 --- a/arch/arm64/kernel/early_printk.c +++ b/arch/arm64/kernel/early_printk.c @@ -31,16 +31,16 @@ static void __iomem *early_base; static void (*printch)(char ch); +void xen_raw_console_write(const char *str); /* * PL011 single character TX. */ static void pl011_printch(char ch) { - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF) - ; - writeb_relaxed(ch, early_base + UART01x_DR); - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY) - ; + char buf[2]; + buf[0] = ch; + buf[1] = '\0'; + xen_raw_console_write(buf); } /* diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index 2dc2831..1f586b3 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c @@ -630,7 +630,7 @@ void xen_raw_console_write(const char *str) ssize_t len = strlen(str); int rc = 0; - if (xen_domain()) { + if (1||xen_domain()) { rc = dom0_write_console(0, str, len); #ifdef CONFIG_X86 if (rc == -ENOSYS && xen_hvm_domain()) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 7228258..e035871 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1674,24 +1674,18 @@ EXPORT_SYMBOL(printk_emit); * * See the vsnprintf() documentation for format string extensions over C99. */ +void xen_raw_console_write(const char *str); asmlinkage __visible int printk(const char *fmt, ...) { va_list args; - int r; + static char buf[512]; -#ifdef CONFIG_KGDB_KDB - if (unlikely(kdb_trap_printk)) { - va_start(args, fmt); - r = vkdb_printf(fmt, args); - va_end(args); - return r; - } -#endif va_start(args, fmt); - r = vprintk_emit(0, -1, NULL, 0, fmt, args); + vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); - return r; + xen_raw_console_write(buf); + return 1; } EXPORT_SYMBOL(printk); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |