All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@ozlabs.org>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	miche@google.com, gregkh@suse.de, linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xensource.com
Subject: Re: Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen.
Date: Mon, 31 Oct 2011 18:18:26 +1030	[thread overview]
Message-ID: <87d3ddppo5.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20111027053007.GA32765@phenom.dumpdata.com>

On Thu, 27 Oct 2011 01:30:08 -0400, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> 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);
 

      parent reply	other threads:[~2011-10-31  7:51 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27  5:30 Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen Konrad Rzeszutek Wilk
2011-10-27  5:34 ` Konrad Rzeszutek Wilk
2011-10-27  5:48 ` Greg KH
2011-10-27 14:45   ` Miche Baker-Harvey
2011-10-27 14:50     ` Fwd: " Miche Baker-Harvey
2011-10-27 15:08     ` Konrad Rzeszutek Wilk
2011-10-27 15:31       ` Konrad Rzeszutek Wilk
2011-10-27 17:22         ` Miche Baker-Harvey
2011-10-27 17:35           ` Konrad Rzeszutek Wilk
2011-10-27 18:39             ` [PATCH] VirtioConsole support Miche Baker-Harvey
2011-10-27 21:15               ` Konrad Rzeszutek Wilk
2011-10-27 21:15                 ` Konrad Rzeszutek Wilk
2011-10-31  9:55               ` Amit Shah
2011-10-31  9:55                 ` Amit Shah
2011-10-27 18:39             ` Miche Baker-Harvey
2011-10-27 21:43             ` Miche Baker-Harvey
2011-10-27 21:43             ` Miche Baker-Harvey
2011-10-27 21:55               ` Konrad Rzeszutek Wilk
2011-10-27 21:55                 ` Konrad Rzeszutek Wilk
2011-10-28 16:27                 ` Greg KH
2011-10-28 16:27                 ` Greg KH
2011-10-28  2:55               ` Joe Perches
2011-10-28  2:55                 ` Joe Perches
2011-10-28 18:19                 ` Stephen Boyd
2011-10-28 18:19                 ` Stephen Boyd
2011-11-02 22:02                   ` Rusty Russell
2011-11-02 22:02                     ` Rusty Russell
2011-11-03 12:38                     ` Christian Borntraeger
2011-11-03 12:38                       ` Christian Borntraeger
2011-11-03 14:15                       ` Konrad Rzeszutek Wilk
2011-11-03 14:15                         ` Konrad Rzeszutek Wilk
2011-11-02  1:13   ` Regression: patch " hvc_console: display printk messages on console." causing infinite loop with 3.2-rc0 + Xen Stephen Rothwell
2011-11-02  1:13     ` Stephen Rothwell
2011-11-02  1:13     ` Stephen Rothwell
2011-11-03  1:30     ` Greg KH
2011-11-03  1:30       ` Greg KH
2011-11-03  1:30       ` Greg KH
2011-11-07  6:19       ` Stephen Rothwell
2011-11-07  6:19         ` Stephen Rothwell
2011-11-07  6:19         ` Stephen Rothwell
2011-11-07 20:24         ` Greg KH
2011-11-07 20:24           ` Greg KH
2011-11-07 20:24           ` Greg KH
2011-10-31  7:48 ` Rusty Russell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d3ddppo5.fsf@rustcorp.com.au \
    --to=rusty@ozlabs.org \
    --cc=gregkh@suse.de \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miche@google.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.