[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87r0igrs8r.fsf@jogness.linutronix.de>
Date: Wed, 17 Jan 2024 14:48:28 +0106
From: John Ogness <john.ogness@...utronix.de>
To: "Chang, Junxiao" <junxiao.chang@...el.com>, Sebastian Andrzej Siewior
<bigeasy@...utronix.de>
Cc: "tglx@...utronix.de" <tglx@...utronix.de>, "rostedt@...dmis.org"
<rostedt@...dmis.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "Li, Hao3" <hao3.li@...el.com>, "Li, Lili"
<lili.li@...el.com>, "Gao, Jianfeng" <jianfeng.gao@...el.com>,
"linux-rt-users@...r.kernel.org" <linux-rt-users@...r.kernel.org>
Subject: RE: [PATCH] printk: nbcon: check uart port is nbcon or not in
nbcon_release
On 2024-01-17, "Chang, Junxiao" <junxiao.chang@...el.com> wrote:
> As you mentioned, same console driver is only registered once. 8250
> console driver is registered once, its "struct console *newcon"
> parameter is address of "univ8250_console" which is defined in
> drivers\tty\serial\8250\8250_core.c.
>
> However, in each serial port device is registered, their cons pointer(
> "struct console *cons;" in "struct uart_port") will be assigned with
> same cons in API serial_core_add_one_port:
>
> uport->cons = drv->cons;
>
> That is, multiple similar 8250 uart_port devices have same console
> pointer which points to above univ8250_console.
Ah. This explains the "(port)->cons->index == (port)->line" check in
uart_console(). Thank you for clarifying.
> BTW, this issue couldn't be reproduced with v6.6.7-rt17 kernel.
The reason for the change is because console registration/unregistration
is not related to the port lock. There is a potential race condition if
nbcon unlocking is based on the UART port still being registered as a
console.
We could move the @locked_port flag to the struct uart_port. (Probably
renaming it to @nbcon_locked_port.) I think that would be the
appropriate fix.
John
Powered by blists - more mailing lists