Revert "printk: fix double printing with earlycon"
This reverts commit cf39bf58. The commit regression to users that define both console=ttyS1 and console=ttyS0 on the command line, see https://lkml.kernel.org/r/20170509082915.GA13236@bistromath.localdomain The kernel log messages always appeared only on one serial port. It is even documented in Documentation/admin-guide/serial-console.rst: "Note that you can only define one console per device type (serial, video)." The above mentioned commit changed the order in which the command line parameters are searched. As a result, the kernel log messages go to the last mentioned ttyS* instead of the first one. We long thought that using two console=ttyS* on the command line did not make sense. But then we realized that console= parameters were handled also by systemd, see http://0pointer.de/blog/projects/serial-console.html "By default systemd will instantiate one serial-getty@.service on the main kernel console, if it is not a virtual terminal." where " If multiple kernel consoles are used simultaneously, the main console is the one listed first in /sys/class/tty/console/active, which is the last one listed on the kernel command line." This puts the original report into another light. The system is running in qemu. The first serial port is used to store the messages into a file. The second one is used to login to the system via a socket. It depends on systemd and the historic kernel behavior. By other words, systemd causes that it makes sense to define both console=ttyS1 console=ttyS0 on the command line. The kernel fix caused regression related to userspace (systemd) and need to be reverted. In addition, it went out that the fix helped only partially. The messages still were duplicated when the boot console was removed early by late_initcall(printk_late_init). Then the entire log was replayed when the same console was registered as a normal one. Link: 20170606160339.GC7604@pathway.suse.cz Cc: Aleksey Makarov <email@example.com> Cc: Sabrina Dubroca <firstname.lastname@example.org> Cc: Sudeep Holla <email@example.com> Cc: Greg Kroah-Hartman <firstname.lastname@example.org> Cc: Peter Hurley <email@example.com> Cc: Jiri Slaby <firstname.lastname@example.org> Cc: Robin Murphy <email@example.com>, Cc: Steven Rostedt <firstname.lastname@example.org> Cc: "Nair, Jayachandran" <Jayachandran.Nair@cavium.com> Cc: email@example.com Cc: firstname.lastname@example.org Reported-by: Sabrina Dubroca <email@example.com> Acked-by: Sergey Senozhatsky <firstname.lastname@example.org> Signed-off-by: Petr Mladek <email@example.com>