All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] virtio: console: fix for early console
@ 2011-09-22 18:14 Amit Shah
  2011-09-22 18:14 ` [PATCH 1/1] virtio: console: wait for first console port for early console output Amit Shah
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Amit Shah @ 2011-09-22 18:14 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Christian Borntraeger, kvm list, Virtualization List, Amit Shah

Hi Rusty,

This is a fix from Christian for early console handling with multiport
support.  Please apply.

Christian, I've made some changes to the patch as noted in the commit
message.  Nothing major, but an ACK would be nice.

Thanks.


Christian Borntraeger (1):
  virtio: console: wait for first console port for early console output

 drivers/char/virtio_console.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

-- 
1.7.6.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] virtio: console: wait for first console port for early console output
  2011-09-22 18:14 [PATCH 0/1] virtio: console: fix for early console Amit Shah
@ 2011-09-22 18:14 ` Amit Shah
  2011-09-22 18:59 ` [PATCH 0/1] virtio: console: fix for early console Christian Borntraeger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Amit Shah @ 2011-09-22 18:14 UTC (permalink / raw)
  To: Rusty Russell
  Cc: Christian Borntraeger, kvm list, Virtualization List, Amit Shah

From: Christian Borntraeger <borntraeger@de.ibm.com>

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.

[Amit:
  * Use NULL instead of 0 for pointer comparison
  * Rename 'port_added' to 'early_console_added'
  * Re-format, re-word commit message
  * Rebase patch on top of current queue]

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 drivers/char/virtio_console.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 9ea3b5e..7f2c6e5 100644
--- 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/freezer.h>
@@ -74,6 +75,7 @@ struct ports_driver_data {
 static struct ports_driver_data pdrvdata;
 
 DEFINE_SPINLOCK(pdrvdata_lock);
+DECLARE_COMPLETION(early_console_added);
 
 /* This struct holds information that's relevant only for console ports */
 struct console {
@@ -1366,6 +1368,7 @@ static void handle_control_message(struct ports_device *portdev,
 			break;
 
 		init_port_console(port);
+		complete(&early_console_added);
 		/*
 		 * Could remove the port here in case init fails - but
 		 * have to notify the host first.
@@ -1668,6 +1671,10 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
 	struct ports_device *portdev;
 	int err;
 	bool multiport;
+	bool early = early_put_chars != NULL;
+
+	/* Ensure to read early_put_chars now */
+	barrier();
 
 	portdev = kmalloc(sizeof(*portdev), GFP_KERNEL);
 	if (!portdev) {
@@ -1739,6 +1746,19 @@ static int __devinit virtcons_probe(struct virtio_device *vdev)
 
 	__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(&early_console_added);
+
 	return 0;
 
 free_vqs:
-- 
1.7.6.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] virtio: console: fix for early console
  2011-09-22 18:14 [PATCH 0/1] virtio: console: fix for early console Amit Shah
  2011-09-22 18:14 ` [PATCH 1/1] virtio: console: wait for first console port for early console output Amit Shah
@ 2011-09-22 18:59 ` Christian Borntraeger
  2011-09-23  4:16   ` Rusty Russell
  2011-10-31 10:21 ` Amit Shah
  2011-10-31 10:21 ` Amit Shah
  3 siblings, 1 reply; 6+ messages in thread
From: Christian Borntraeger @ 2011-09-22 18:59 UTC (permalink / raw)
  To: Amit Shah; +Cc: Rusty Russell, kvm list, Virtualization List

On 22/09/11 20:14, Amit Shah wrote:
> Hi Rusty,
> 
> This is a fix from Christian for early console handling with multiport
> support.  Please apply.
> 
> Christian, I've made some changes to the patch as noted in the commit
> message.  Nothing major, but an ACK would be nice.

The changes look fine.
Acked-by: Chrstian Borntraeger <borntraeger@de.ibm.com>

Christian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] virtio: console: fix for early console
  2011-09-22 18:59 ` [PATCH 0/1] virtio: console: fix for early console Christian Borntraeger
@ 2011-09-23  4:16   ` Rusty Russell
  0 siblings, 0 replies; 6+ messages in thread
From: Rusty Russell @ 2011-09-23  4:16 UTC (permalink / raw)
  To: Christian Borntraeger, Amit Shah; +Cc: kvm list, Virtualization List

On Thu, 22 Sep 2011 20:59:13 +0200, Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> On 22/09/11 20:14, Amit Shah wrote:
> > Hi Rusty,
> > 
> > This is a fix from Christian for early console handling with multiport
> > support.  Please apply.
> > 
> > Christian, I've made some changes to the patch as noted in the commit
> > message.  Nothing major, but an ACK would be nice.
> 
> The changes look fine.
> Acked-by: Chrstian Borntraeger <borntraeger@de.ibm.com>

Thanks, applied.

Cheers,
Rusty.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] virtio: console: fix for early console
  2011-09-22 18:14 [PATCH 0/1] virtio: console: fix for early console Amit Shah
                   ` (2 preceding siblings ...)
  2011-10-31 10:21 ` Amit Shah
@ 2011-10-31 10:21 ` Amit Shah
  3 siblings, 0 replies; 6+ messages in thread
From: Amit Shah @ 2011-10-31 10:21 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christian Borntraeger, kvm list, Virtualization List

On (Thu) 22 Sep 2011 [23:44:22], Amit Shah wrote:
> Hi Rusty,
> 
> This is a fix from Christian for early console handling with multiport
> support.  Please apply.
> 
> Christian, I've made some changes to the patch as noted in the commit
> message.  Nothing major, but an ACK would be nice.
> 
> Thanks.

Hey Rusty can you push this fix for 3.2?

Thanks

		Amit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] virtio: console: fix for early console
  2011-09-22 18:14 [PATCH 0/1] virtio: console: fix for early console Amit Shah
  2011-09-22 18:14 ` [PATCH 1/1] virtio: console: wait for first console port for early console output Amit Shah
  2011-09-22 18:59 ` [PATCH 0/1] virtio: console: fix for early console Christian Borntraeger
@ 2011-10-31 10:21 ` Amit Shah
  2011-10-31 10:21 ` Amit Shah
  3 siblings, 0 replies; 6+ messages in thread
From: Amit Shah @ 2011-10-31 10:21 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Christian Borntraeger, kvm list, Virtualization List

On (Thu) 22 Sep 2011 [23:44:22], Amit Shah wrote:
> Hi Rusty,
> 
> This is a fix from Christian for early console handling with multiport
> support.  Please apply.
> 
> Christian, I've made some changes to the patch as noted in the commit
> message.  Nothing major, but an ACK would be nice.
> 
> Thanks.

Hey Rusty can you push this fix for 3.2?

Thanks

		Amit

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-31 10:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-22 18:14 [PATCH 0/1] virtio: console: fix for early console Amit Shah
2011-09-22 18:14 ` [PATCH 1/1] virtio: console: wait for first console port for early console output Amit Shah
2011-09-22 18:59 ` [PATCH 0/1] virtio: console: fix for early console Christian Borntraeger
2011-09-23  4:16   ` Rusty Russell
2011-10-31 10:21 ` Amit Shah
2011-10-31 10:21 ` Amit Shah

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.