I have a hack that works. Perhaps it will give a bit more understanding so that a proper patch can be created. My changes were applied on top of 4.9-rc1 with the patch from https://www.linux-mips.org/archives/linux-mips/2016-10/msg00130.html, and were as follows:

Index: linux/kernel/printk/printk.c
===================================================================
--- linux.orig/kernel/printk/printk.c   2016-10-24 12:29:17.838938604 -0500
+++ linux/kernel/printk/printk.c        2016-10-24 19:31:20.012593000 -0500
@@ -2657,7 +2657,9 @@
         *      didn't select a console we take the first one
         *      that registers here.
         */
-       if (preferred_console < 0 && !of_specified_console) {
+ pr_info("Before: newcon->device %p, newcon->setup %p\n", newcon->device, newcon->setup);
+       if ((preferred_console < 0 && !of_specified_console) ||
+           !newcon->setup) {
                if (newcon->index < 0)
                        newcon->index = 0;
                if (newcon->setup == NULL ||
@@ -2670,6 +2672,7 @@
                }
        }

+ pr_info("After: newcon->device %p, newcon->setup %p\n", newcon->device, newcon->setup);
        /*
         *      See if this console matches one we selected on
         *      the command line.

The changes in commit 05fd007e4629 prevent the body of the 'if ((preferred_console < 0 ...' loop from ever being executed; however, the failure indicates that we do need to go through this code at least once. I tested various quantities, and !newcon->setup was the only one that helped.

The outputs from the pr_info statements above and the changes in console as shown by 'dmesg | egrep "console|newcon" are:

[    0.000000] Before: newcon->device   (null), newcon->setup   (null)
        Part of the body of if executed
[    0.000000] After: newcon->device   (null), newcon->setup   (null)
[    0.000000] bootconsole [udbg0] enabled
[    0.001581] Before: newcon->device c0326e34, newcon->setup   (null)
        We now have newcon->device set, Part of body of if executed
[    0.001934] After: newcon->device c0326e34, newcon->setup   (null)
[    0.002285] console [tty0] enabled
[    0.002595] bootconsole [udbg0] disabled
[    0.002913] Before: newcon->device c032cc4c, newcon->setup c032cc80
        This time the body of if is not executed and will not be executed 
anymore.
[    0.002925] After: newcon->device c032cc4c, newcon->setup c032cc80
[    0.002943] Before: newcon->device c0331ad8, newcon->setup c0331c34
[    0.002956] After: newcon->device c0331ad8, newcon->setup c0331c34
[    0.003060] Before: newcon->device c0331ad8, newcon->setup c068dbc8
[    0.003074] After: newcon->device c0331ad8, newcon->setup c068dbc8
[    0.003322] Before: newcon->device c0331ad8, newcon->setup c068ddc4
[    0.003335] After: newcon->device c0331ad8, newcon->setup c068ddc4
[    1.993661] Before: newcon->device c0331ad8, newcon->setup c068dbc8
[    1.993759] After: newcon->device c0331ad8, newcon->setup c068dbc8
[    1.994395] Before: newcon->device c0331ad8, newcon->setup c068dbc8
[    1.994492] After: newcon->device c0331ad8, newcon->setup c068dbc8

Larry


Reply via email to