Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
Pavel Machek wrote: > You have drivers/xen... so maybe arch/i386/xen is easier to type? > arch/i386/paravirt/xen would make some sense, too, but it looks too > deep to me. I think the exact placement of these files needs a bit of work. I don't much care about xen/ vs paravirt/xen vs paravirt-xen/, but placement of headers needs a bit more thought. lhype, er, lguest and vmi are in kernel/, but I think it would be nice to put them near Xen. J - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
Hi! > This provides a bootstrap and ongoing emergency console which is > intended to be available from very early during boot and at all times > thereafter, in contrast with alternatives such as UDP-based syslogd, > or logging in via ssh. The protocol is based on a simple shared-memory > ring buffer. > > Signed-off-by: Ian Pratt <[EMAIL PROTECTED]> > Signed-off-by: Christian Limpach <[EMAIL PROTECTED]> > Signed-off-by: Chris Wright <[EMAIL PROTECTED]> > > --- > arch/i386/kernel/early_printk.c|2 > arch/i386/paravirt-xen/enlighten.c |3 > drivers/Makefile |3 > drivers/xen/Makefile |1 You have drivers/xen... so maybe arch/i386/xen is easier to type? arch/i386/paravirt/xen would make some sense, too, but it looks too deep to me. Pavel -- Thanks for all the (sleeping) penguins. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
Alan wrote: > Andrew: No objection to this tty stuff being merged provided the bugs > noted above (not worried about the sign stuff) are fixed before it goes > on to Linus. > Thanks for the comments. I'll see if I can put together a fixup patch before LCA, but possibly not. J - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
> +#endif > + tty_insert_flip_char(xencons_tty, buf[i], 0); Please use the defines like TTY_NORMAL not just 0. > + if ((xencons_tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && > + (xencons_tty->ldisc.write_wakeup != NULL)) > + (xencons_tty->ldisc.write_wakeup)(xencons_tty); > + } You are't allowed to derefence and call ldisc methods without holding the lock. You can replace that chunk with a call to the helper function tty_wakeup(tty). Small but real race condition otherwise as you xencons_tty->ldisc may be changing as you call it. > +static inline int __xencons_put_char(int ch) > +{ > + char _ch = (char)ch; > + if ((wp - wc) == wbuf_size) > + return 0; > + wbuf[WBUF_MASK(wp++)] = _ch; > + return 1; > +} A lot of very confusing sign stuff here - you turn an int into a char and put it into a uchar array > + for (i = 0; i < count; i++) > + if (!__xencons_put_char(buf[i])) > + break; The int coming from a uchar array Don't think its wrong - just acutely weird and perhaps could be tidier > +static void xencons_close(struct tty_struct *tty, struct file *filp) > +{ > + unsigned long flags; > + > + mutex_lock(&tty_mutex); It would be good in future if you could avoid using tty_mutex and use a private lock. At the moment vt "borrows" it and there are a couple of incestuous spots but the plan is to eventually fix them and make it private to tty_io. Andrew: No objection to this tty stuff being merged provided the bugs noted above (not worried about the sign stuff) are fixed before it goes on to Linus. Alan - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch 16/20] XEN-paravirt: Add the Xen virtual console driver.
This provides a bootstrap and ongoing emergency console which is intended to be available from very early during boot and at all times thereafter, in contrast with alternatives such as UDP-based syslogd, or logging in via ssh. The protocol is based on a simple shared-memory ring buffer. Signed-off-by: Ian Pratt <[EMAIL PROTECTED]> Signed-off-by: Christian Limpach <[EMAIL PROTECTED]> Signed-off-by: Chris Wright <[EMAIL PROTECTED]> --- arch/i386/kernel/early_printk.c|2 arch/i386/paravirt-xen/enlighten.c |3 drivers/Makefile |3 drivers/xen/Makefile |1 drivers/xen/console/Makefile |2 drivers/xen/console/console.c | 588 drivers/xen/console/xencons_ring.c | 144 include/xen/xencons.h | 14 init/main.c|2 9 files changed, 759 insertions(+) === --- a/arch/i386/kernel/early_printk.c +++ b/arch/i386/kernel/early_printk.c @@ -1,2 +1,4 @@ +#ifndef CONFIG_XEN #include "../../x86_64/kernel/early_printk.c" +#endif === --- a/arch/i386/paravirt-xen/enlighten.c +++ b/arch/i386/paravirt-xen/enlighten.c @@ -798,6 +798,9 @@ static asmlinkage void __init xen_start_ INITRD_START = xen_start_info->mod_start ? __pa(xen_start_info->mod_start) : 0; INITRD_SIZE = xen_start_info->mod_len; + /* use Xen console */ + vgacon_enabled = 0; + /* Start the world */ start_kernel(); } === --- a/drivers/Makefile +++ b/drivers/Makefile @@ -14,6 +14,9 @@ obj-$(CONFIG_ACPI)+= acpi/ # was used and do nothing if so obj-$(CONFIG_PNP) += pnp/ obj-$(CONFIG_ARM_AMBA) += amba/ + +# Xen is the default console when running as a guest +obj-$(CONFIG_XEN) += xen/ # char/ comes before serial/ etc so that the VT console is the boot-time # default. === --- /dev/null +++ b/drivers/xen/Makefile @@ -0,0 +1,1 @@ +obj-y += console/ === --- /dev/null +++ b/drivers/xen/console/Makefile @@ -0,0 +1,2 @@ + +obj-y := console.o xencons_ring.o === --- /dev/null +++ b/drivers/xen/console/console.c @@ -0,0 +1,588 @@ +/** + * console.c + * + * Virtual console driver. + * + * Copyright (c) 2002-2004, K A Fraser. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "../../../arch/i386/paravirt-xen/events.h" +#include + +MODULE_LICENSE("Dual BSD/GPL"); + +static int xc_disabled = 0; +static int xc_num = -1; + +/* /dev/xvc0 device number allocated by lanana.org. */ +#define XEN_XVC_MAJOR 204 +#define XEN_XVC_MINOR 191 + +#ifdef CONFIG_MAGIC_SYSRQ +static unsigned long sysrq_requested; +#endif + +static int __init xencons_setup(char *str) +{ + if (!strcmp(str, "off")) + xc_disabled = 1; + return 1; +} +__setup("xencons=", xencons_setup); + +/* The kernel and user-land drivers share a common transmit buffer. */ +static u