WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: Regression: patch " hvc_console: display printk messages

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, miche@xxxxxxxxxx, gregkh@xxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen.
From: Rusty Russell <rusty@xxxxxxxxxx>
Date: Mon, 31 Oct 2011 18:18:26 +1030
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 14 Nov 2011 15:18:28 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20111027053007.GA32765@xxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20111027053007.GA32765@xxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Notmuch/0.6.1-1 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu)
On Thu, 27 Oct 2011 01:30:08 -0400, Konrad Rzeszutek Wilk 
<konrad.wilk@xxxxxxxxxx> wrote:
Non-text part: multipart/mixed
> Hey Miche.
> 
> The git commit 361162459f62dc0826b82c9690a741a940f457f0:
> 
>     hvc_console: display printk messages on console.
> 
> is causing an infinite loop when booting Linux under Xen, as so:

lguest too.

This is not a concurrency problem: the issue seems to be that calling
register_console() twice on the same struct console is a bad idea.

Simple fix which works here (might be completely wrong):

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -197,6 +197,8 @@ static int __init hvc_console_setup(stru
        return 0;
 }
 
+static bool console_registered = false;
+
 static struct console hvc_console = {
        .name           = "hvc",
        .write          = hvc_console_print,
@@ -224,6 +226,7 @@ static struct console hvc_console = {
 static int __init hvc_console_init(void)
 {
        register_console(&hvc_console);
+       console_registered = true;
        return 0;
 }
 console_initcall(hvc_console_init);
@@ -279,8 +282,10 @@ int hvc_instantiate(uint32_t vtermno, in
         * now (setup won't fail at this point).  It's ok to just
         * call register again if previously .setup failed.
         */
-       if (index == hvc_console.index)
+       if (index == hvc_console.index && !console_registered) {
                register_console(&hvc_console);
+               console_registered = true;
+       }
 
        return 0;
 }
@@ -868,7 +873,10 @@ struct hvc_struct *hvc_alloc(uint32_t vt
 
        list_add_tail(&(hp->next), &hvc_structs);
        spin_unlock(&hvc_structs_lock);
-       register_console(&hvc_console);
+       if (!console_registered) {
+               register_console(&hvc_console);
+               console_registered = true;
+       }
 
        return hp;
 }
@@ -880,6 +888,7 @@ int hvc_remove(struct hvc_struct *hp)
        struct tty_struct *tty;
 
        unregister_console(&hvc_console);
+       console_registered = false;
        spin_lock_irqsave(&hp->lock, flags);
        tty = tty_kref_get(hp->tty);
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] Re: Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen., Rusty Russell <=