Ian Campbell
2013-Nov-22 16:24 UTC
[PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
Setting synchronous console ensures that any printk hits the buffer immediately and that any outstanding queued log messages are flushed. This ensures that such log messages are not being printed while the secondary CPU may be using early_printk during early bringup. Signed-of-by: Ian Campbell <ian.campbell@citrix.com> Cc: Keir Fraser <keir@xen.org> --- v2: improved commit message. --- xen/arch/arm/smpboot.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c index b6a1307..f6cd9d7 100644 --- a/xen/arch/arm/smpboot.c +++ b/xen/arch/arm/smpboot.c @@ -28,6 +28,7 @@ #include <xen/softirq.h> #include <xen/timer.h> #include <xen/irq.h> +#include <xen/console.h> #include <asm/gic.h> cpumask_t cpu_online_map; @@ -356,6 +357,8 @@ int __cpu_up(unsigned int cpu) if ( rc < 0 ) return rc; + console_start_sync(); /* Secondary may use early_printk */ + /* Tell the remote CPU which stack to boot on. */ init_data.stack = idle_vcpu[cpu]->arch.stack; @@ -368,6 +371,8 @@ int __cpu_up(unsigned int cpu) rc = arch_cpu_up(cpu); + console_end_sync(); + if ( rc < 0 ) { printk("Failed to bring up CPU%d\n", cpu); -- 1.7.10.4
Julien Grall
2013-Nov-22 17:36 UTC
Re: [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
On 11/22/2013 04:24 PM, Ian Campbell wrote:> Setting synchronous console ensures that any printk hits the buffer > immediately and that any outstanding queued log messages are flushed. This > ensures that such log messages are not being printed while the secondary CPU > may be using early_printk during early bringup.stefano: There is some place in x86 (shutdown, kexec) when console_*_sync are used. So far after console_endboot. I think it''s also fine for us.> Signed-of-by: Ian Campbell <ian.campbell@citrix.com> > Cc: Keir Fraser <keir@xen.org> > --- > v2: improved commit message. > --- > xen/arch/arm/smpboot.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c > index b6a1307..f6cd9d7 100644 > --- a/xen/arch/arm/smpboot.c > +++ b/xen/arch/arm/smpboot.c > @@ -28,6 +28,7 @@ > #include <xen/softirq.h> > #include <xen/timer.h> > #include <xen/irq.h> > +#include <xen/console.h> > #include <asm/gic.h> > > cpumask_t cpu_online_map; > @@ -356,6 +357,8 @@ int __cpu_up(unsigned int cpu) > if ( rc < 0 ) > return rc; > > + console_start_sync(); /* Secondary may use early_printk */ > +I though have asked on the first version this question: early printk is only enabled when CONFIG_EARLY_PRINTK is defined. Why don''t you surround console_*_sync with #ifdef CONFIG_EARLY_PRINTK? -- Julien Grall
Ian Campbell
2013-Nov-22 17:49 UTC
Re: [PATCH v2 12/15] xen: arm: enable synchronous console while starting secondary CPUs
On Fri, 2013-11-22 at 17:36 +0000, Julien Grall wrote:> > + console_start_sync(); /* Secondary may use early_printk */ > > + > > I though have asked on the first version this question:Sorry, don''t remember seeing this.> early printk is only enabled when CONFIG_EARLY_PRINTK is defined. Why > don''t you surround console_*_sync with #ifdef CONFIG_EARLY_PRINTK?I don''t see any need, it is harmless even if !early_printk and it just adds clutter to this function to ifdef it. Ian.