Re: [RFC/PATCH] printk: Fix preferred console selection with multiple matches

From: Sergey Senozhatsky
Date: Wed Dec 11 2019 - 20:23:24 EST


On (19/12/11 10:17), Petr Mladek wrote:
> And this would exactly happen as pointed out by Sergey. match() does
> also some setup operations. I would be scared to call them twice.
>
> > This looks indeed a lot more invasive. Is there any reason why what I
> > propose wouldn't work as a first patch that can easily be backported ?
>
> Your solution is not acceptable because it might cause calling
> match() more times.
>
> The reverse search of list of console does not work for ttySX
> consoles because the number is omitted when matching. And the messages
> will appear only on the first matched serial console. There is
> a paragraph about this in the commit message of my patch.

A fast path for preferred_console match()/setup() sounds like
something that may work. There won't be double setup()-s and
we scan console list in the same direction. We just have
separate match()/setup() for preferred_console. Do you think
this won't do the trick?

-ss