[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191211125303.3s2ck3sfr2ypkt7w@pathway.suse.cz>
Date: Wed, 11 Dec 2019 13:53:03 +0100
From: Petr Mladek <pmladek@...e.com>
To: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC/PATCH] printk: Fix preferred console selection with
multiple matches
On Wed 2019-12-11 15:02:02, Benjamin Herrenschmidt wrote:
> On Wed, 2019-12-11 at 11:01 +0900, Sergey Senozhatsky wrote:
> > On (19/12/11 09:26), Benjamin Herrenschmidt wrote:
> >
>
> > As far as I know, ->match() does not only match but also does ->setup().
> > If we have two console list entries that match (one via aliasing and one
> > via exact match) then the console driver is setup twice. Do all console
> > drivers handle it? [double setup]
>
> I don't think it's an issue but I may be wrong. I had a quick look
> at some of the drivers and I don't really see why they would break but
> I couldn't look at them all and I might be mistaken.
>
> We could skip setup if the console is already enabled but I would
> advise against that since the two calls might have different options
> (the firmware baud rate could be different from the command line one
> for example) and we want the options for the last one.
For example:
+ ip22zilog_console_setup() calls __ip22zilog_startup() that does
some initialization of the device
+ pl011_console_setup() does some non-trivial things as well.
Honestly, I am not familiar with these devices. I am not sure if it is
dangerous or safe to call these functions twice.
I am not sure if anybody would know this for sure. Therefore I suggest a
conservative approach and avoid calling setup() twice().
I think that it is dangerous and error-prone design. The best solution
would be to split setup() and match() functionality.
Best Regards,
Petr
Powered by blists - more mailing lists