lkml.org 
[lkml]   [2017]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v9 3/3] printk: fix double printing with earlycon
On (05/12/17 14:57), Petr Mladek wrote:
[..]
> I have tried to reproduce the problem and started kernel with
> console=ttyS1 console=ttyS0 in qemu. It created:
>
> console_cmdline = {{
> .name = "ttyS";
> .index = 1; // from ttyS1
> },{
> .name = "ttyS"
> .index = 0; // from ttyS0
> }};
> preferred_console = 1; // ttyuS0;
>
>
> Then register_console() is called twice here. First time
> from con_init() that registers:
>
> static struct console vt_console_driver = {
> .name = "tty",
> .write = vt_console_print,
> .device = vt_console_device,
> .unblank = unblank_screen,
> .flags = CON_PRINTBUFFER,
> .index = -1,
> };
>
> It does not match and it is not enabled here.
>
>
> 2nd times from univ8250_console_init() that registers:
>
> static struct console univ8250_console = {
> .name = "ttyS",
> .write = univ8250_console_write,
> .device = uart_console_device,
> .setup = univ8250_console_setup,
> .match = univ8250_console_match,
> .flags = CON_PRINTBUFFER | CON_ANYTIME,
> .index = -1,
> .data = &serial8250_reg,
> };
>
> It matches both console_cmdline entries because index = -1.
> The first tested is selected.

yes, that's what I observed on my host. I didn't try it with qemu,
just 86_64. and the behaviour was different.

[..]
> In fact, it always was kind of random because both init calls are
> defined as
>
> console_initcall(con_init);
> console_initcall(univ8250_console_init);
>
> They are put into special elf section and called from console_init()
> the following way:
>
> call = __con_initcall_start;
> while (call < __con_initcall_end) {
> (*call)();
> call++;
> }
>
> By other words, the order depends on the linking order which is
> kind of weak order enforcement.
>
> I am not sure if we broke some backward compatibility or actually made
> it more predictable in the long term.

well, we changed the behaviour. some automated scripts somewhere might
get broken. so may be this is the case when "a bug" becomes "a feature".
well, just saying.

-ss

\
 
 \ /
  Last update: 2017-05-13 13:49    [W:0.153 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site