public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 3] Xen core patch : runtime VT console disable
@ 2004-11-17 23:51 Ian Pratt
  2004-11-18  2:56 ` Andrew Morton
  2004-11-18 10:13 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Ian Pratt @ 2004-11-17 23:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ian.Pratt, akpm, Keir.Fraser, Christian.Limpach, alan


This patch enables the VT console to be disabled at runtime even if it
is built into the kernel. arch-xen needs this to avoid trying to
initialise a VT in virtual machine that doesn't have access to the
console hardware.

Signed-off-by: ian.pratt@cl.cam.ac.uk

---

diff -Nurp pristine-linux-2.6.9/drivers/char/tty_io.c linux-2.6.9-xen-sparse/drivers/char/tty_io.c       
--- pristine-linux-2.6.9/drivers/char/tty_io.c  2004-10-18 22:54:32.000000000 +0100
+++ linux-2.6.9-xen-sparse/drivers/char/tty_io.c        2004-11-17 01:51:48.000000000 +0000
@@ -131,6 +131,8 @@ LIST_HEAD(tty_drivers);                     /* linked list
    vt.c for deeply disgusting hack reasons */
 DECLARE_MUTEX(tty_sem);
 
+int console_use_vt = 1;
+
 #ifdef CONFIG_UNIX98_PTYS
 extern struct tty_driver *ptm_driver;  /* Unix98 pty masters; for /dev/ptmx */
 extern int pty_limit;          /* Config limit on Unix98 ptys */
@@ -1739,7 +1741,7 @@ retry_open:
                goto got_driver;
        }
 #ifdef CONFIG_VT
-       if (device == MKDEV(TTY_MAJOR,0)) {
+       if (console_use_vt && device == MKDEV(TTY_MAJOR,0)) {
                extern int fg_console;
                extern struct tty_driver *console_driver;
                driver = console_driver;
@@ -1959,7 +1961,7 @@ static int tiocswinsz(struct tty_struct 
        if (!memcmp(&tmp_ws, &tty->winsize, sizeof(*arg)))
                return 0;
 #ifdef CONFIG_VT
-       if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
+       if (console_use_vt && tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
                unsigned int currcons = tty->index;
                int rc;
 
@@ -2933,14 +2935,19 @@ static int __init tty_init(void)
 #endif
 
 #ifdef CONFIG_VT
-       cdev_init(&vc0_cdev, &console_fops);
-       if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
-           register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
-               panic("Couldn't register /dev/tty0 driver\n");
-       devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR, "vc/0");
-       class_simple_device_add(tty_class, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
+       if (console_use_vt) {
+               cdev_init(&vc0_cdev, &console_fops);
+               if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
+                   register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1,
+                                          "/dev/vc/0") < 0)
+                       panic("Couldn't register /dev/tty0 driver\n");
+               devfs_mk_cdev(MKDEV(TTY_MAJOR, 0), S_IFCHR|S_IRUSR|S_IWUSR,
+                             "vc/0");
+               class_simple_device_add(tty_class, MKDEV(TTY_MAJOR, 0), NULL,
+                                       "tty0");
 
-       vty_init();
+               vty_init();
+       }
 #endif
        return 0;
 }


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

* Re: [patch 3] Xen core patch : runtime VT console disable
  2004-11-17 23:51 [patch 3] Xen core patch : runtime VT console disable Ian Pratt
@ 2004-11-18  2:56 ` Andrew Morton
  2004-11-18  9:59   ` Gerd Knorr
  2004-11-18 10:13 ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2004-11-18  2:56 UTC (permalink / raw)
  To: Ian Pratt; +Cc: linux-kernel, Ian.Pratt, Keir.Fraser, Christian.Limpach, alan

Ian Pratt <Ian.Pratt@cl.cam.ac.uk> wrote:
>
>  --- pristine-linux-2.6.9/drivers/char/tty_io.c  2004-10-18 22:54:32.000000000 +0100
>  +++ linux-2.6.9-xen-sparse/drivers/char/tty_io.c        2004-11-17 01:51:48.000000000 +0000
>  @@ -131,6 +131,8 @@ LIST_HEAD(tty_drivers);                     /* linked list
>      vt.c for deeply disgusting hack reasons */
>   DECLARE_MUTEX(tty_sem);

This patch has had its tabs replaced by spaces.


>  +int console_use_vt = 1;

Should this not have static scope?

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

* Re: [patch 3] Xen core patch : runtime VT console disable
  2004-11-18  2:56 ` Andrew Morton
@ 2004-11-18  9:59   ` Gerd Knorr
  2004-11-18 10:09     ` Ian Pratt
  0 siblings, 1 reply; 5+ messages in thread
From: Gerd Knorr @ 2004-11-18  9:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ian Pratt, linux-kernel, Keir.Fraser, Christian.Limpach, alan

Andrew Morton <akpm@osdl.org> writes:

> >  +int console_use_vt = 1;
> 
> Should this not have static scope?

I'd like to have that one globally visible, so that code somewhere in
arch/{xen|um} can enable/disable that at boot time depending on the
virtual machine configuration.

  Gerd

-- 
#define printk(args...) fprintf(stderr, ## args)

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

* Re: [patch 3] Xen core patch : runtime VT console disable
  2004-11-18  9:59   ` Gerd Knorr
@ 2004-11-18 10:09     ` Ian Pratt
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Pratt @ 2004-11-18 10:09 UTC (permalink / raw)
  To: Gerd Knorr
  Cc: Andrew Morton, Ian Pratt, linux-kernel, Keir.Fraser,
	Christian.Limpach, alan, Ian.Pratt

> Andrew Morton <akpm@osdl.org> writes:
> 
> > >  +int console_use_vt = 1;
> > 
> > Should this not have static scope?
> 
> I'd like to have that one globally visible, so that code somewhere in
> arch/{xen|um} can enable/disable that at boot time depending on the
> virtual machine configuration.

Yep, that's why we need it global. In
arch/xen/i386/kernel/setup.c we set it to zero if the virtual
machine doesn't have access to the console hardware.

Ian

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

* Re: [patch 3] Xen core patch : runtime VT console disable
  2004-11-17 23:51 [patch 3] Xen core patch : runtime VT console disable Ian Pratt
  2004-11-18  2:56 ` Andrew Morton
@ 2004-11-18 10:13 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2004-11-18 10:13 UTC (permalink / raw)
  To: Ian Pratt; +Cc: linux-kernel, akpm, Keir.Fraser, Christian.Limpach, alan

On Wed, Nov 17, 2004 at 11:51:14PM +0000, Ian Pratt wrote:
> 
> This patch enables the VT console to be disabled at runtime even if it
> is built into the kernel. arch-xen needs this to avoid trying to
> initialise a VT in virtual machine that doesn't have access to the
> console hardware.

You should only need the conditional initialization - all the runtime
checks couldn't be reached anymore if the device isn't actually registered.


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

end of thread, other threads:[~2004-11-18 10:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-17 23:51 [patch 3] Xen core patch : runtime VT console disable Ian Pratt
2004-11-18  2:56 ` Andrew Morton
2004-11-18  9:59   ` Gerd Knorr
2004-11-18 10:09     ` Ian Pratt
2004-11-18 10:13 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox