Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1501546 > unrolled thread
| Started by | Andreas Schwab <schwab@linux-m68k.org> |
|---|---|
| First post | 2016-10-16 20:10 +0200 |
| Last post | 2016-10-18 11:30 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path Andreas Schwab <schwab@linux-m68k.org> - 2016-10-16 20:10 +0200
Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path Paul Burton <paul.burton@imgtec.com> - 2016-10-17 12:40 +0200
Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path Andreas Schwab <schwab@linux-m68k.org> - 2016-10-17 19:50 +0200
[PATCH] console: use first console if stdout-path device doesn't appear Paul Burton <paul.burton@imgtec.com> - 2016-10-18 11:20 +0200
Re: [PATCH] console: use first console if stdout-path device doesn't appear Andreas Schwab <schwab@linux-m68k.org> - 2016-10-18 21:10 +0200
Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path Paul Burton <paul.burton@imgtec.com> - 2016-10-18 11:30 +0200
| From | Andreas Schwab <schwab@linux-m68k.org> |
|---|---|
| Date | 2016-10-16 20:10 +0200 |
| Subject | Re: [PATCH v2] console: Don't prefer first registered if DT specifies stdout-path |
| Message-ID | <ssY2J-NN-7@gated-at.bofh.it> |
On Aug 09 2016, Paul Burton <paul.burton@imgtec.com> wrote: > Fix this by not automatically preferring the first registered console if > one is specified by the device tree. This allows consoles to be > registered but not enabled, and once the driver for the console selected > by stdout-path calls of_console_check() the driver will be added to the > list of preferred consoles before any other console has been enabled. > When that console is then registered via register_console() it will be > enabled as expected. This breaks the console on PowerMac. There is no output and it panics eventually. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
[toc] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-10-17 12:40 +0200 |
| Message-ID | <stduO-2hG-17@gated-at.bofh.it> |
| In reply to | #1501546 |
[Multipart message — attachments visible in raw view] — view raw
On Sunday, 16 October 2016 20:07:18 BST Andreas Schwab wrote:
> On Aug 09 2016, Paul Burton <paul.burton@imgtec.com> wrote:
> > Fix this by not automatically preferring the first registered console if
> > one is specified by the device tree. This allows consoles to be
> > registered but not enabled, and once the driver for the console selected
> > by stdout-path calls of_console_check() the driver will be added to the
> > list of preferred consoles before any other console has been enabled.
> > When that console is then registered via register_console() it will be
> > enabled as expected.
>
> This breaks the console on PowerMac. There is no output and it panics
> eventually.
>
> Andreas.
Hi Andreas,
Could you share the device tree from your system?
Thanks,
Paul
[toc] | [prev] | [next] | [standalone]
| From | Andreas Schwab <schwab@linux-m68k.org> |
|---|---|
| Date | 2016-10-17 19:50 +0200 |
| Message-ID | <stkcV-6Af-13@gated-at.bofh.it> |
| In reply to | #1501862 |
On Okt 17 2016, Paul Burton <paul.burton@imgtec.com> wrote:
> Could you share the device tree from your system?
This is the contents of chosen/linux,stdout-path on the systems I have:
chosen/linux,stdout-path
"/pci@f0000000/ATY,SnowyParent@10/ATY,Snowy_A@0"
chosen/linux,stdout-path
"/pci@0,f0000000/NVDA,Parent@10/NVDA,Display-B@1"
Is that what you need? There is also chosen/stdout, but no
aliases/stdout.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-10-18 11:20 +0200 |
| Subject | [PATCH] console: use first console if stdout-path device doesn't appear |
| Message-ID | <styIV-876-9@gated-at.bofh.it> |
| In reply to | #1502311 |
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 console in the
console_drivers list.
As I don't have access to an affected system this has only been build
tested - testing would be most appreciated.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 05fd007e4629 ("console: don't prefer first registered if DT specifies stdout-path")
Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Cc: Andreas Schwab <schwab@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
---
A potential alternative to this might be to have the affected offb
driver call of_check_console(), and perhaps that should happen anyway,
but doing so seems non-trivial since the offb driver doesn't know the
index of the framebuffer console device it may be about to register &
the fbdev core doesn't know the associated device tree node. This also
wouldn't catch the case of us not having a driver for the device
specified by stdout-path, so this fallback seems worthwhile anyway.
---
kernel/printk/printk.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index d5e3973..7091e2f 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2835,10 +2835,45 @@ 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 preferred console
+ * using of_console_check(). In these cases we attempt here to enable the
+ * first registered console.
*/
static int __init printk_late_init(void)
{
- struct console *con;
+ struct console *con, *enabled;
+
+ if (of_specified_console) {
+ console_lock();
+
+ /* Find the enabled console, if there is one */
+ enabled = NULL;
+ for_each_console(con) {
+ if (!(con->flags & CON_ENABLED))
+ continue;
+
+ enabled = con;
+ break;
+ }
+
+ /* Enable the first console if none were already enabled */
+ con = console_drivers;
+ if (!enabled && con) {
+ if (con->index < 0)
+ con->index = 0;
+ if (con->setup == NULL ||
+ con->setup(con, NULL) == 0) {
+ con->flags |= CON_ENABLED;
+ if (con->device)
+ con->flags |= CON_CONSDEV;
+ }
+ }
+
+ console_unlock();
+ }
for_each_console(con) {
if (!keep_bootcon && con->flags & CON_BOOT) {
--
2.10.0
[toc] | [prev] | [next] | [standalone]
| From | Andreas Schwab <schwab@linux-m68k.org> |
|---|---|
| Date | 2016-10-18 21:10 +0200 |
| Subject | Re: [PATCH] console: use first console if stdout-path device doesn't appear |
| Message-ID | <stHVT-65p-7@gated-at.bofh.it> |
| In reply to | #1502816 |
On Okt 18 2016, Paul Burton <paul.burton@imgtec.com> 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 console in the > console_drivers list. > > As I don't have access to an affected system this has only been build > tested - testing would be most appreciated. Unfortunately that doesn't work. The initial console still cannot be opened. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."
[toc] | [prev] | [next] | [standalone]
| From | Paul Burton <paul.burton@imgtec.com> |
|---|---|
| Date | 2016-10-18 11:30 +0200 |
| Message-ID | <stySB-8al-17@gated-at.bofh.it> |
| In reply to | #1502311 |
[Multipart message — attachments visible in raw view] — view raw
On Monday, 17 October 2016 19:39:57 BST Andreas Schwab wrote:
> On Okt 17 2016, Paul Burton <paul.burton@imgtec.com> wrote:
> > Could you share the device tree from your system?
>
> This is the contents of chosen/linux,stdout-path on the systems I have:
>
> chosen/linux,stdout-path
> "/pci@f0000000/ATY,SnowyParent@10/ATY,Snowy_A@0"
>
> chosen/linux,stdout-path
> "/pci@0,f0000000/NVDA,Parent@10/NVDA,Display-B@1"
>
> Is that what you need? There is also chosen/stdout, but no
> aliases/stdout.
>
> Andreas.
Hi Andreas,
I think I see the problem & I'm hoping this patch will fix it:
https://lkml.org/lkml/2016/10/18/142
Could you give it a try & let me know?
Thanks,
Paul
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web