[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:
> Thanks,
> I manged to do something similar in the meantime. I am seeing a crash after I 
> do /etc/init.d/xencommns start
> 
> [<ffffffc00038fee4>] clear_bit+0x14/0x30
> [<ffffffc0003d9ca4>] ack_dynirq+0x44/0x58
> [<ffffffc0000e6a34>] handle_edge_irq+0x74/0x178
> [<ffffffc0003dc0e8>] evtchn_fifo_handle_events+0x280/0x288
> [<ffffffc0003d8f50>] __xen_evtchn_do_upcall+0x68/0xd0
> [<ffffffc0003d8fc0>] xen_hvm_evtchn_do_upcall+0x8/0x18
> [<ffffffc00009271c>] xen_arm_callback+0x4c/0x68
> [<ffffffc0000e7560>] handle_percpu_devid_irq+0x88/0x120
> [<ffffffc0000e38b4>] generic_handle_irq+0x24/0x40
> [<ffffffc000084890>] handle_IRQ+0x40/0xa8
> [<ffffffc000081348>] gic_handle_irq+0x50/0xa0
> 
> I found that consume_one_event calls handle_irq_for_port which gets IRQ=7 in 
> case of a crash.
> What is the use of IRQ 7 ?
> IRQ1 is UART which i saw in cat /proc/interrupts

What kernel version are you using?

It looks like the FIFO event channel is not properly initialized.
You could try switching to the old style 2-level ABI:

diff --git a/drivers/xen/events/events_fifo.c b/drivers/xen/events/events_fifo.c
index 84b4bfb..4a23e08 100644
--- a/drivers/xen/events/events_fifo.c
+++ b/drivers/xen/events/events_fifo.c
@@ -428,6 +428,8 @@ int __init xen_evtchn_fifo_init(void)
        int cpu = get_cpu();
        int ret;
 
+       return -1;
+
        ret = evtchn_fifo_init_control_block(cpu);
        if (ret < 0)
                goto out;

You should then see this message at boot:

xen:events: Using 2-level ABI



> -Regards
> Manish
> 
> 
> On 7 August 2014 18:14, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> 
> wrote:
>       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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.