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

Re: [Xen-devel] [RFC 4/6] xen/console: Add support for early printk



On Sun, 2014-01-05 at 21:26 +0000, Julien Grall wrote:
> On ARM, a function (early_printk) was introduced to output message when the
> serial port is not initialized.
> 
> This solution is fragile because the developper needs to know when the serial
> port is initialized, to use either early_printk or printk. Moreover some
> functions (mainly in common code), only use printk. This will result to a loss
> of message sometimes.
> 
> Directly call early_printk in console code when the serial port is not yet
> initialized. For this purpose use serial_steal_fn.

This relies on nothing stealing the console over the period where the
console is initialised. Perhaps that is already not advisable/possible?

> 
> Cc: Keir Fraser <keir@xxxxxxx>
> Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
> ---
>  xen/drivers/char/console.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
> index 532c426..f83c92e 100644
> --- a/xen/drivers/char/console.c
> +++ b/xen/drivers/char/console.c
> @@ -28,6 +28,9 @@
>  #include <asm/debugger.h>
>  #include <asm/div64.h>
>  #include <xen/hypercall.h> /* for do_console_io */
> +#ifdef CONFIG_EARLY_PRINTK
> +#include <asm/early_printk.h>
> +#endif
>  
>  /* console: comma-separated list of console outputs. */
>  static char __initdata opt_console[30] = OPT_CONSOLE_STR;
> @@ -245,7 +248,12 @@ long read_console_ring(struct xen_sysctl_readconsole *op)
>  static char serial_rx_ring[SERIAL_RX_SIZE];
>  static unsigned int serial_rx_cons, serial_rx_prod;
>  
> -static void (*serial_steal_fn)(const char *);
> +#ifndef CONFIG_EARLY_PRINTK
> +static inline void early_puts(const char *str)
> +{}

This duplicates bits of asm-arm/early_printk.h. I think if the feature
is going to be used from common code then the common bits of the asm
header should be moved to xen/early_printk.h. If any per-arch stuff
remains then xen/e_p.h can include asm/e_p.h.

> +#endif
> +
> +static void (*serial_steal_fn)(const char *) = early_puts;
>  
>  int console_steal(int handle, void (*fn)(const char *))
>  {
> @@ -652,7 +660,10 @@ void __init console_init_preirq(void)
>          else if ( !strncmp(p, "none", 4) )
>              continue;
>          else if ( (sh = serial_parse_handle(p)) >= 0 )
> +        {
>              sercon_handle = sh;
> +            serial_steal_fn = NULL;
> +        }
>          else
>          {
>              char *q = strchr(p, ',');



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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