All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, mingo@redhat.com
Subject: Re: xen: Make hvc0 the preferred console in domU
Date: Wed, 02 Apr 2008 09:21:34 -0700	[thread overview]
Message-ID: <47F3B28E.3090803@goop.org> (raw)
In-Reply-To: <87iqz0e24y.fsf@pike.pond.sub.org>

Markus Armbruster wrote:
> This turns out to a thornier problem than one might think.
>
> Consoles tty, hvc and ttyS register in this order.
>
> Unless the kernel command line dictates otherwise, the first one to
> register becomes the preferred console (the one behind /dev/console).
> This is tty.  Except we patched things so that hvc wins over tty in
> domU.  That's what we want there; tty is the dummy console there.
>
> Enter PV framebuffer.  It turns tty into a useful console, which we
> want to use.  But the PVFB is created only if it's enabled for this
> domain, and we learn that from xenstore.
>
> Problem: when tty registers, we can't yet know whether the PVFB is
> enabled.  By the time we can know, the console setup game is over.
>   

Why's that?  Is it because xenbus setup is too late?  Could we do an 
earlier query?

> The non-pvops PVFB has the same problem.  Jeremy Katz solved it there
> with a fairly gross hack: right after the Xen console is up, at the
> end of xencons_init(), we forcefully make the Xen console the
> preferred console if the PVFB is disabled:
>
>         /* Check about framebuffer messing up the console */
>         if (!is_initial_xendomain() &&
> 	    !xenbus_exists(XBT_NIL, "device", "vfb")) {
> 		/* FIXME: this is ugly */
> 		unregister_console(&kcons_info);
> 		kcons_info.flags |= CON_CONSDEV;
> 		register_console(&kcons_info);
> 	}
>
> Aside: we tried to get that into linux-2.6.18-xen.hg a couple of times
> before we gave up.  If you use that tree unmodified, you simply get no
> working console when you diable the PVFB.
>
> I append the straight pvops port of this hack.
>
> Instead of putting hvc_force_consdev() into hvc_console.c, we could
> also have a force_console() in kernel/printk.c, like this:
>
> void
> force_console(char *name, int index)
> {
> 	struct console *c, *cc;
>
> 	acquire_console_sem();
> 	for (c = console_drivers; c->next; c = c->next) {
> 		cc = c->next;
> 		if (!strcmp(cc->name, name) && cc->index == index) {
> 			c->next = c->next->next;
> 			cc->next = console_drivers;
> 			console_drivers->flags &= ~CON_CONSDEV;
> 			console_drivers = cc;
> 			cc->flags |= CON_CONSDEV;
> 			break;
> 		}
> 	}
> 	release_console_sem();
> }
>
> If one of these two hacks is acceptable, I'll prepare a proper patch.
> If not, I'd appreciate advice on how to solve this better.
>   

The console system supports multiple concurrent consoles, doesn't it?  
With the limitation that only one of them can be the source of keyboard 
input.  Can we support that, so that even if the user gets the config 
wrong they can still see some output (and we can printk a helpful 
message so they can work out how to get it working).  Ideally we could 
take input from all the consoles too, so there's no reason to 
exclusively choose one over any other...

But aside from that, it doesn't seem like our problem is particularly 
strange.  One can imagine many circumstances in which we come up using 
whatever's currently available as a console, but then a better console 
device appears during device probing.   In other words, this kind of 
console device switching seems like something that the console subsystem 
should support.

But in the meantime, pragmatics should win, and I don't have any strong 
objections to this patch.

    J

  reply	other threads:[~2008-04-02 16:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-27 13:56 xen: Make hvc0 the preferred console in domU Markus Armbruster
2008-03-31  6:36 ` Jeremy Fitzhardinge
2008-03-31  8:27   ` Markus Armbruster
2008-03-31  8:27   ` Markus Armbruster
2008-04-02 14:56   ` Markus Armbruster
2008-04-02 16:21     ` Jeremy Fitzhardinge [this message]
2008-04-02 17:01       ` Markus Armbruster
2008-04-02 17:01       ` Markus Armbruster
2008-04-02 16:21     ` Jeremy Fitzhardinge
2008-04-02 14:56   ` Markus Armbruster
2008-03-31  6:36 ` Jeremy Fitzhardinge
  -- strict thread matches above, loose matches on Subject: below --
2008-02-27 13:56 Markus Armbruster

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=47F3B28E.3090803@goop.org \
    --to=jeremy@goop.org \
    --cc=armbru@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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.