From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org,
Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH next v1] serial: msm_serial: disable interrupts in __msm_console_write()
Date: Tue, 10 May 2022 12:01:54 +0200 [thread overview]
Message-ID: <Yno4Eo6ZcmQRqs1B@alley> (raw)
In-Reply-To: <20220506213324.470461-1-john.ogness@linutronix.de>
On Fri 2022-05-06 23:39:24, John Ogness wrote:
> __msm_console_write() assumes that interrupts are disabled, but
> with threaded console printers it is possible that the write()
> callback of the console is called with interrupts enabled.
IMHO, it would be nice to include the lockdep splat from
https://lore.kernel.org/r/bb5cadc3-0940-7f5c-7a1b-8120ddac9039@samsung.com
> Explicitly disable interrupts using local_irq_save() to preserve
> the assumed context.
>
> Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
Otherwise, it looks good to me:
Reviewed-by: Petr Mladek <pmladek@suse.com>
> Note: I checked the other serial drivers and this was the only
> one that assumed interrupts off for write().
Great.
Best Regards,
Petr
> drivers/tty/serial/msm_serial.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index 23c94b927776..e676ec761f18 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -1599,6 +1599,7 @@ static inline struct uart_port *msm_get_port_from_line(unsigned int line)
> static void __msm_console_write(struct uart_port *port, const char *s,
> unsigned int count, bool is_uartdm)
> {
> + unsigned long flags;
> int i;
> int num_newlines = 0;
> bool replaced = false;
> @@ -1616,6 +1617,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
> num_newlines++;
> count += num_newlines;
>
> + local_irq_save(flags);
> +
> if (port->sysrq)
> locked = 0;
> else if (oops_in_progress)
> @@ -1661,6 +1664,8 @@ static void __msm_console_write(struct uart_port *port, const char *s,
>
> if (locked)
> spin_unlock(&port->lock);
> +
> + local_irq_restore(flags);
> }
>
> static void msm_console_write(struct console *co, const char *s,
>
> base-commit: 38a288f5941ef03752887ad86f2d85442358c99a
> --
> 2.30.2
prev parent reply other threads:[~2022-05-10 10:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 21:33 [PATCH next v1] serial: msm_serial: disable interrupts in __msm_console_write() John Ogness
2022-05-10 10:01 ` Petr Mladek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yno4Eo6ZcmQRqs1B@alley \
--to=pmladek@suse.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox