From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: KVM list <kvm@vger.kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
Carsten Otte <cotte@de.ibm.com>,
virtualization@lists.linux-foundation.org
Subject: [RFC/PATCH] virtio-console: wait for console ports
Date: Wed, 21 Sep 2011 17:52:23 +0200 [thread overview]
Message-ID: <4E7A0837.5080908@de.ibm.com> (raw)
Amit,
can you have a look at the patch below and give feedback or apply
if appropriate?
---
On s390 I have seen some random "Warning: unable to open an initial
console" boot failure. Turns out that tty_open fails, because the
hvc_alloc was not yet done. In former times this could not happen,
since the probe function automatically called hvc_alloc. With newer
versions (multiport) some host<->guest interaction is required
before hvc_alloc is called. This might be too late, especially if
an initramfs is involved. Lets use a completion if we have
multiport and an early console.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
drivers/char/virtio_console.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
Index: b/drivers/char/virtio_console.c
===================================================================
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -19,6 +19,7 @@
*/
#include <linux/cdev.h>
#include <linux/debugfs.h>
+#include <linux/completion.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/fs.h>
@@ -73,6 +74,7 @@ struct ports_driver_data {
static struct ports_driver_data pdrvdata;
DEFINE_SPINLOCK(pdrvdata_lock);
+DECLARE_COMPLETION(port_added);
/* This struct holds information that's relevant only for console ports */
struct console {
@@ -1352,6 +1354,7 @@ static void handle_control_message(struc
break;
init_port_console(port);
+ complete(&port_added);
/*
* Could remove the port here in case init fails - but
* have to notify the host first.
@@ -1648,6 +1651,10 @@ static int __devinit virtcons_probe(stru
struct ports_device *portdev;
int err;
bool multiport;
+ bool early = early_put_chars != 0;
+
+ /* Ensure to read early_put_chars now */
+ barrier();
portdev = kmalloc(sizeof(*portdev), GFP_KERNEL);
if (!portdev) {
@@ -1719,6 +1726,17 @@ static int __devinit virtcons_probe(stru
__send_control_msg(portdev, VIRTIO_CONSOLE_BAD_ID,
VIRTIO_CONSOLE_DEVICE_READY, 1);
+
+ /* If there was an early virtio console, assume that there are no
+ * other consoles. We need to wait until the hvc_alloc matches the
+ * hvc_instantiate, otherwise tty_open will complain, resulting in
+ * a "Warning: unable to open an initial console" boot failure.
+ * Without multiport this is done in add_port above. With multiport
+ * this might take some host<->guest communication - thus we have to
+ * wait. */
+ if (multiport && early)
+ wait_for_completion(&port_added);
+
return 0;
free_vqs:
next reply other threads:[~2011-09-21 15:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-21 15:52 Christian Borntraeger [this message]
2011-09-22 10:08 ` [RFC/PATCH] virtio-console: wait for console ports Amit Shah
2011-09-22 11:20 ` Christian Borntraeger
2011-09-22 11:30 ` Amit Shah
2011-09-22 12:19 ` [PATCHv2] " Christian Borntraeger
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=4E7A0837.5080908@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=amit.shah@redhat.com \
--cc=cotte@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/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.