From patchwork Thu Aug 7 14:36:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 35046 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9C94E21137 for ; Thu, 7 Aug 2014 14:39:59 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf11246692qge.8 for ; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:in-reply-to:message-id :references:user-agent:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type; bh=Kl8Aiwmig5lZisD/Igk8miT0igC938clIyNleObTEuI=; b=dPPWdtGKFMRBbsmL0/Vla62MMWx9ltVkpLQxyve3WGJZ/imHVwcngOUE8Q2k1Mokfy KJUsmaOpswlJzFjETayEVflCQsZrYKOUWsCXUoNe11harTHU4rQUvnOhvW6sJzZeRKYH hMlwGI7c9ooN6mAscpFWVMuBiolePAqCwHDTF5utcSrxdn5M2iOOy3On+gSqyK7qCxLW jZ2k20CCNJwvwOzVIMzfQ65I0sRBadVF7kASESFMI8CBCF9WfIOs28Nbxk75DepSMykY qaEYjnUZi7WNMZg1iOG1+lV8K5skpqbMI3IWSAc6r37FLpBUI4qXEQjaqOcvoq4Q5sGP 8Lmg== X-Gm-Message-State: ALoCoQkGqPXaZw1ayp2tE+x6uVTFyJVG9hWw/p1hKluXgbbEry/N9WonYJ7Dz9odGWgRbS/uyqxr X-Received: by 10.236.63.67 with SMTP id z43mr1584325yhc.11.1407422399481; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.107 with SMTP id r98ls160698qga.71.gmail; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) X-Received: by 10.52.248.42 with SMTP id yj10mr2374035vdc.50.1407422399402; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id x5si1845130vcy.51.2014.08.07.07.39.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Aug 2014 07:39:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id hq11so6397415vcb.16 for ; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) X-Received: by 10.52.83.227 with SMTP id t3mr2418182vdy.20.1407422399319; Thu, 07 Aug 2014 07:39:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp35602vcb; Thu, 7 Aug 2014 07:39:58 -0700 (PDT) X-Received: by 10.50.87.10 with SMTP id t10mr68627215igz.41.1407422398470; Thu, 07 Aug 2014 07:39:58 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id bu3si10997973icc.40.2014.08.07.07.39.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 Aug 2014 07:39:58 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFOpB-00042o-D0; Thu, 07 Aug 2014 14:37:49 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFOp9-00042j-Ma for xen-devel@lists.xenproject.org; Thu, 07 Aug 2014 14:37:47 +0000 Received: from [193.109.254.147:16582] by server-15.bemta-14.messagelabs.com id E9/CB-30948-A3F83E35; Thu, 07 Aug 2014 14:37:46 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-13.tower-27.messagelabs.com!1407422265!14361681!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26355 invoked from network); 7 Aug 2014 14:37:46 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-13.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 7 Aug 2014 14:37:46 -0000 X-IronPort-AV: E=Sophos;i="5.01,818,1400025600"; d="scan'208";a="159682262" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Thu, 7 Aug 2014 10:37:44 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XFOp5-0004Gr-UN; Thu, 07 Aug 2014 15:37:43 +0100 Date: Thu, 7 Aug 2014 15:36:30 +0100 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: manish jaggi In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Campbell , Vijay Kilari , Stefano Stabellini , manish.jaggi@caviumnetworks.com, Julien Grall , stefano.stabellini@citrix.com, David Vrabel , xen-devel@lists.xenproject.org Subject: Re: [Xen-devel] How to display dom0 kernel printk on hvc0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: 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 > > [] clear_bit+0x14/0x30 > [] ack_dynirq+0x44/0x58 > [] handle_edge_irq+0x74/0x178 > [] evtchn_fifo_handle_events+0x280/0x288 > [] __xen_evtchn_do_upcall+0x68/0xd0 > [] xen_hvm_evtchn_do_upcall+0x8/0x18 > [] xen_arm_callback+0x4c/0x68 > [] handle_percpu_devid_irq+0x88/0x120 > [] generic_handle_irq+0x24/0x40 > [] handle_IRQ+0x40/0xa8 > [] 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: You should then see this message at boot: xen:events: Using 2-level ABI > -Regards > Manish > > > On 7 August 2014 18:14, Stefano Stabellini 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); >   > > > > 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;