[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] Xen virtual console driver question


  • To: "Amos Waterland" <apw@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Ian Pratt" <m+Ian.Pratt@xxxxxxxxxxxx>
  • Date: Thu, 3 Aug 2006 00:20:55 +0100
  • Delivery-date: Wed, 02 Aug 2006 16:21:34 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: Aca2fLmp3t26Ys45T5mIt3EVqiBDVQACk7Ug
  • Thread-topic: [Xen-devel] Xen virtual console driver question

 
> I am currently using the below patch, but would really prefer not to.
> It's basic approach is to have the Xen virtual console driver react
> "gracefully" in the case that a real serial driver has already
> registered ttyS0-ttyS3.  It's current behavior is to fail if the 8250
> driver was initialized ahead of it, and console is lost.  In the
process
> I found a bug in Linux, and have included the patch for it since
> otherwise the Xen driver initialization will succeed but with negative
> side effects in the kobject subsystem.

It would certainly be good to split the linux bug fix out and submit it
upstream, and put it in our patches directory in the meantime.

Grabbing the next free minor aint pretty, but I agree its an
improvement.

Ian  

 
> What is the story?
> 
> ---
> 
> diff -r 17aa29a18b08 arch/powerpc/configs/xen_maple_defconfig
> --- a/arch/powerpc/configs/xen_maple_defconfig        Thu Jul 27
18:57:20 2006 -
> 0400
> +++ b/arch/powerpc/configs/xen_maple_defconfig        Mon Jul 31
21:04:17 2006 -
> 0400
> @@ -704,10 +704,18 @@ CONFIG_HW_CONSOLE=y
>  #
>  # Serial drivers
>  #
> +CONFIG_SERIAL_8250=y
> +CONFIG_SERIAL_8250_CONSOLE=y
> +CONFIG_SERIAL_8250_PCI=y
> +CONFIG_SERIAL_8250_NR_UARTS=4
> +CONFIG_SERIAL_8250_RUNTIME_UARTS=4
> +# CONFIG_SERIAL_8250_EXTENDED is not set
> 
>  #
>  # Non-8250 serial port support
>  #
> +CONFIG_SERIAL_CORE=y
> +CONFIG_SERIAL_CORE_CONSOLE=y
>  # CONFIG_SERIAL_ICOM is not set
>  # CONFIG_SERIAL_JSM is not set
>  CONFIG_UNIX98_PTYS=y
> @@ -1307,7 +1315,7 @@ CONFIG_XEN_BLKDEV_FRONTEND=y
>  CONFIG_XEN_BLKDEV_FRONTEND=y
>  CONFIG_XEN_NETDEV_FRONTEND=y
>  CONFIG_XEN_SCRUB_PAGES=y
> -CONFIG_XEN_DISABLE_SERIAL=y
> +# CONFIG_XEN_DISABLE_SERIAL is not set
>  CONFIG_XEN_SYSFS=y
>  # CONFIG_XEN_COMPAT_030002_AND_LATER is not set
>  CONFIG_XEN_COMPAT_LATEST_ONLY=y
> diff -r 17aa29a18b08 drivers/xen/console/console.c
> --- a/drivers/xen/console/console.c   Thu Jul 27 18:57:20 2006 -0400
> +++ b/drivers/xen/console/console.c   Mon Jul 31 21:04:17 2006 -0400
> @@ -70,6 +70,7 @@
>   */
>  static enum { XC_OFF, XC_DEFAULT, XC_TTY, XC_SERIAL } xc_mode =
> XC_DEFAULT;
>  static int xc_num = -1;
> +enum { XC_NUM_MAX = 8 };
> 
>  #ifdef CONFIG_MAGIC_SYSRQ
>  static unsigned long sysrq_requested;
> @@ -576,6 +577,7 @@ static int __init xencons_init(void)
> 
>       xencons_ring_init();
> 
> +retry:
>       xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ?
>                                         1 : MAX_NR_CONSOLES);
>       if (xencons_driver == NULL)
> @@ -612,6 +614,15 @@ static int __init xencons_init(void)
>                      DRV(xencons_driver)->name_base);
>               put_tty_driver(xencons_driver);
>               xencons_driver = NULL;
> +
> +             /* Somebody, almost certainly the real serial port
> +                driver, registered ahead of us, so find the first
> +                unused minor.  */
> +             if (xc_num <= XC_NUM_MAX) {
> +                 xc_num++;
> +                 goto retry;
> +             }
> +
>               return rc;
>       }
> 
> diff -r 17aa29a18b08 fs/char_dev.c
> --- a/fs/char_dev.c   Thu Jul 27 18:57:20 2006 -0400
> +++ b/fs/char_dev.c   Mon Jul 31 21:04:17 2006 -0400
> @@ -111,10 +111,13 @@ __register_chrdev_region(unsigned int ma
> 
>       for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
>               if ((*cp)->major > major ||
> -                 ((*cp)->major == major && (*cp)->baseminor >=
baseminor))
> +                 ((*cp)->major == major &&
> +                  (((*cp)->baseminor >= baseminor) ||
> +                   ((*cp)->baseminor + (*cp)->minorct > baseminor))))
>                       break;
>       if (*cp && (*cp)->major == major &&
> -         (*cp)->baseminor < baseminor + minorct) {
> +         (((*cp)->baseminor < baseminor + minorct) ||
> +          ((*cp)->baseminor + (*cp)->minorct > baseminor))) {
>               ret = -EBUSY;
>               goto out;
>       }
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.