From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [RFC 4/6] xen/console: Add support for early printk Date: Thu, 20 Feb 2014 16:38:11 +0000 Message-ID: <53062F73.5090600@linaro.org> References: <1388957191-10337-1-git-send-email-julien.grall@linaro.org> <1388957191-10337-5-git-send-email-julien.grall@linaro.org> <1392808746.23084.137.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WGWdc-0004aH-9I for xen-devel@lists.xenproject.org; Thu, 20 Feb 2014 16:38:16 +0000 Received: by mail-ee0-f52.google.com with SMTP id c41so202042eek.39 for ; Thu, 20 Feb 2014 08:38:14 -0800 (PST) In-Reply-To: <1392808746.23084.137.camel@kazak.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: xen-devel@lists.xenproject.org, Keir Fraser , stefano.stabellini@eu.citrix.com, tim@xen.org, patches@linaro.org List-Id: xen-devel@lists.xenproject.org Hi Ian, On 02/19/2014 11:19 AM, Ian Campbell wrote: > 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? serial_steal_fn is set in console_steal. This function checks if the serial handle is valid. This handle is only valid after console_init_preirq (which set serial_steal_fn to NULL). So I think we are safe. >> >> Cc: Keir Fraser >> Signed-off-by: Julien Grall >> --- >> 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 >> #include >> #include /* for do_console_io */ >> +#ifdef CONFIG_EARLY_PRINTK >> +#include >> +#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. I will do. Cheers, -- Julien Grall