Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-11-03 Thread Paul Burton
On Monday, 31 October 2016 18:31:43 GMT Larry Finger wrote:
> On 10/31/2016 06:09 PM, Sergey Senozhatsky wrote:
> > Hi,
> > 
> > On (10/31/16 15:50), Paul Burton wrote:
> > [..]
> > 
> >> Actually whilst this fixes the output in QEMU it has other problems. I'm
> >> still digging...
> > 
> > I propose a revert of '05fd007e46296', so you guys can find the
> > problem and fix it, not being under 'rc3' pressure.
> 
> If we were at -rc4 or -rc5, then I would agree; however, I think there is
> still time to fix the problem.
> 
> Larry

Hi Larry et al,

If you could give the v3 I just submitted a try that would be great:

https://patchwork.kernel.org/patch/9410849/

If it still doesn't work for you then we're back to a place where I can't test 
an affected system, since QEMU pseries now works fine with my patch. Would you 
perhaps be able to get some console output by specifying console= on 
the kernel command line? Doing that ought to be unaffected by 05fd007e4629 
("console: don't prefer first registered if DT specifies stdout-path") and 
could be a way to get us some debug output.

Thanks,
Paul

signature.asc
Description: This is a digitally signed message part.


Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Michael Ellerman
Sergey Senozhatsky  writes:
> On (10/31/16 15:50), Paul Burton wrote:
> [..]
>> Actually whilst this fixes the output in QEMU it has other problems. I'm 
>> still 
>> digging...
>
> I propose a revert of '05fd007e46296', so you guys can find the
> problem and fix it, not being under 'rc3' pressure.

Yeah I agree. The v2 fix doesn't work for me either.

Paul are you OK with that? And if so are you happy to send a revert to
Linus?

cheers


Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Sergey Senozhatsky
Hi,

On (10/31/16 15:50), Paul Burton wrote:
[..]
> Actually whilst this fixes the output in QEMU it has other problems. I'm 
> still 
> digging...

I propose a revert of '05fd007e46296', so you guys can find the
problem and fix it, not being under 'rc3' pressure.

-ss


Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Larry Finger

On 10/31/2016 06:09 PM, Sergey Senozhatsky wrote:

Hi,

On (10/31/16 15:50), Paul Burton wrote:
[..]

Actually whilst this fixes the output in QEMU it has other problems. I'm still
digging...


I propose a revert of '05fd007e46296', so you guys can find the
problem and fix it, not being under 'rc3' pressure.


If we were at -rc4 or -rc5, then I would agree; however, I think there is still 
time to fix the problem.


Larry




Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Larry Finger

On 10/31/2016 10:50 AM, Paul Burton wrote:

On Monday, 31 October 2016 12:14:55 GMT Paul Burton wrote:

If a device tree specified a preferred device for kernel console output
via the stdout-path or linux,stdout-path chosen node properties there's
no guarantee that it will have specified a device for which we have a
driver. It may also be the case that we do have a driver but it doesn't
call of_console_check() to register as a preferred console (eg. offb
driver as used on powermac systems). In these cases try to ensure that
we provide some console output by enabling the first usable registered
console, which we keep track of with the of_fallback_console variable.

Tested in QEMU with a PowerPC pseries_defconfig kernel.


Actually whilst this fixes the output in QEMU it has other problems. I'm still
digging...


As expected, it does n ot work with 4.9-rc3 on the real PowerPC.

Larry




Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Larry Finger

On 10/31/2016 07:14 AM, Paul Burton wrote:

If a device tree specified a preferred device for kernel console output
via the stdout-path or linux,stdout-path chosen node properties there's
no guarantee that it will have specified a device for which we have a
driver. It may also be the case that we do have a driver but it doesn't
call of_console_check() to register as a preferred console (eg. offb
driver as used on powermac systems). In these cases try to ensure that
we provide some console output by enabling the first usable registered
console, which we keep track of with the of_fallback_console variable.

Tested in QEMU with a PowerPC pseries_defconfig kernel.


The patch fails to fix my real PowerPC. I still get a kernel panic for an 
attempt to kill init. This first test was done with 4.9-rc2. I am in the process 
of updating to -rc3 to see if that changes anything. Later today when that build 
finishes, I will report those results.


Larry



Re: [PATCH v2] console: use first console if stdout-path device doesn't appear

2016-10-31 Thread Paul Burton
On Monday, 31 October 2016 12:14:55 GMT Paul Burton wrote:
> If a device tree specified a preferred device for kernel console output
> via the stdout-path or linux,stdout-path chosen node properties there's
> no guarantee that it will have specified a device for which we have a
> driver. It may also be the case that we do have a driver but it doesn't
> call of_console_check() to register as a preferred console (eg. offb
> driver as used on powermac systems). In these cases try to ensure that
> we provide some console output by enabling the first usable registered
> console, which we keep track of with the of_fallback_console variable.
> 
> Tested in QEMU with a PowerPC pseries_defconfig kernel.

Actually whilst this fixes the output in QEMU it has other problems. I'm still 
digging...

Thanks,
Paul

> 
> Signed-off-by: Paul Burton 
> Fixes: 05fd007e4629 ("console: don't prefer first registered if DT specifies
> stdout-path") Reported-by: Andreas Schwab 
> Reported-by: Larry Finger 
> Reported-by: Michael Ellerman 
> Cc: Andreas Schwab 
> Cc: Andrew Morton 
> Cc: Borislav Petkov 
> Cc: Larry Finger 
> Cc: Michael Ellerman 
> Cc: Petr Mladek 
> Cc: Sergey Senozhatsky 
> Cc: Tejun Heo 
> Cc: linux-ker...@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> 
> ---
> 
> Changes in v2:
> - Split enable_console() out of register_console() & call in the fallback
> case. - Track the console we would have enabled as of_fallback_console.
> 
>  kernel/printk/printk.c | 60
> +- 1 file changed, 55
> insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index de08fc9..b02c00a 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -264,6 +264,13 @@ void console_set_by_of(void)
>  # define of_specified_console false
>  #endif
> 
> +/*
> + * The first usable console, which we'll fall back to using if the system
> + * uses a device tree which indicates a stdout-path device for which we
> + * have no driver, or for which our driver doesn't call of_console_check().
> + */
> +static struct console *of_fallback_console;
> +
>  /* Flag: console code may call schedule() */
>  static int console_may_schedule;
> 
> @@ -2598,6 +2605,8 @@ static int __init keep_bootcon_setup(char *str)
> 
>  early_param("keep_bootcon", keep_bootcon_setup);
> 
> +static void enable_console(struct console *newcon);
> +
>  /*
>   * The console driver calls this routine during kernel initialization
>   * to register the console printing procedure with printk() and to
> @@ -2620,7 +2629,6 @@ early_param("keep_bootcon", keep_bootcon_setup);
>  void register_console(struct console *newcon)
>  {
>   int i;
> - unsigned long flags;
>   struct console *bcon = NULL;
>   struct console_cmdline *c;
> 
> @@ -2657,7 +2665,9 @@ void register_console(struct console *newcon)
>*  didn't select a console we take the first one
>*  that registers here.
>*/
> - if (preferred_console < 0 && !of_specified_console) {
> + if (preferred_console < 0 && of_specified_console) {
> + of_fallback_console = of_fallback_console ?: newcon;
> + } else if (preferred_console < 0) {
>   if (newcon->index < 0)
>   newcon->index = 0;
>   if (newcon->setup == NULL ||
> @@ -2705,8 +2715,18 @@ void register_console(struct console *newcon)
>   break;
>   }
> 
> - if (!(newcon->flags & CON_ENABLED))
> - return;
> + if (newcon->flags & CON_ENABLED)
> + enable_console(newcon);
> +}
> +EXPORT_SYMBOL(register_console);
> +
> +static void enable_console(struct console *newcon)
> +{
> + struct console *bcon = NULL;
> + unsigned long flags;
> +
> + if (console_drivers && console_drivers->flags & CON_BOOT)
> + bcon = console_drivers;
> 
>   /*
>* If we have a bootconsole, and are switching to a real console,
> @@ -2777,7 +2797,6 @@ void register_console(struct console *newcon)
>   unregister_console(bcon);
>   }
>  }
> -EXPORT_SYMBOL(register_console);
> 
>  int unregister_console(struct console *console)
>  {
> @@ -2839,10 +2858,41 @@ EXPORT_SYMBOL(unregister_console);
>   * intersects with the init section. Note that code exists elsewhere to get
> * rid of the boot console as soon as the proper console shows up, so there
> * won't be side-effects from postponing the removal.
> + *
> + * Additionally we may be using a device tree which specifies valid
> + * stdout-path referencing a device for which we don't have a driver, or
> for + * which we have a driver that doesn't register itself as