From: "Jaewon Kim" <jaewon02.kim@samsung.com>
To: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>
Cc: "'Krzysztof Kozlowski'" <krzk@kernel.org>,
"'Alim Akhtar'" <alim.akhtar@samsung.com>,
"'Jiri Slaby'" <jirislaby@kernel.org>,
<linux-samsung-soc@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-serial@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"'Chanho Park'" <chanho61.park@samsung.com>
Subject: RE: [PATCH 1/1] tty: serial: samsung: add spin_lock for interrupt and console_write
Date: Tue, 5 Apr 2022 15:40:39 +0900 [thread overview]
Message-ID: <001601d848b8$10c97490$325c5db0$@samsung.com> (raw)
In-Reply-To: <YkvNQJ5hBhQKCwcU@kroah.com>
Hello
On 22. 4. 5. 14:01, Greg Kroah-Hartman wrote:
> On Tue, Apr 05, 2022 at 12:38:54PM +0900, Jaewon Kim wrote:
> > The console_write and IRQ handler can run concurrently.
> > Problems may occurs console_write is continuously executed while the
> > IRQ handler is running.
> >
> > Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> > ---
> > drivers/tty/serial/samsung_tty.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
>
> What commit does this fix?
This is not an issue caused by anohter commits.
There was potential issue from the beginning.
Other drivers were fixed, but samsung_tty was not.
PL011 patch : https://lkml.org/lkml/2012/2/1/495
>
> >
> > diff --git a/drivers/tty/serial/samsung_tty.c
> > b/drivers/tty/serial/samsung_tty.c
> > index e1585fbae909..d362e8e114f1 100644
> > --- a/drivers/tty/serial/samsung_tty.c
> > +++ b/drivers/tty/serial/samsung_tty.c
> > @@ -2480,12 +2480,26 @@ s3c24xx_serial_console_write(struct console *co, const char *s,
> > unsigned int count)
> > {
> > unsigned int ucon = rd_regl(cons_uart, S3C2410_UCON);
> > + unsigned long flags;
> > + int locked = 1;
>
> bool?
It is return value of spin_trylock()
I used int because mose drivers used int.
If you guide to change int to bool, I will change it.
>
> >
> > /* not possible to xmit on unconfigured port */
> > if (!s3c24xx_port_configured(ucon))
> > return;
> >
> > + local_irq_save(flags);
> > + if (cons_uart->sysrq)
> > + locked = 0;
> > + else if (oops_in_progress)
> > + locked = spin_trylock(&cons_uart->lock);
> > + else
> > + spin_lock(&cons_uart->lock);
> > +
> > uart_console_write(cons_uart, s, count,
> > s3c24xx_serial_console_putchar);
> > +
> > + if (locked)
> > + spin_unlock(&cons_uart->lock);
> > + local_irq_restore(flags);
>
> Why is irq_save required as well as a spinlock?
No special reason.
I will change spin_trylock() -? spin_trylock_irqsave().
spin_lock -> spin_lock_irqsave().
And, remove local_irq_save/restore.
It looks more clean.
>
> thanks,
>
> greg k-h
Thanks
Jaewon Kim
next prev parent reply other threads:[~2022-04-05 6:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220405033448epcas2p31f211cf1cd702ad647f75eee36b2d9f4@epcas2p3.samsung.com>
2022-04-05 3:38 ` [PATCH 0/1] tty: serial: samsung: add spin_lock in console_write Jaewon Kim
2022-04-05 3:38 ` [PATCH 1/1] tty: serial: samsung: add spin_lock for interrupt and console_write Jaewon Kim
2022-04-05 5:01 ` Greg Kroah-Hartman
2022-04-05 6:40 ` Jaewon Kim [this message]
2022-04-06 8:22 [PATCH v2 0/1] tty: serial: samsung: add spin_lock in console_write Jaewon Kim
2022-04-06 8:22 ` [PATCH 1/1] tty: serial: samsung: add spin_lock for interrupt and console_write Jaewon Kim
2022-04-06 8:21 ` Greg Kroah-Hartman
2022-04-06 8:39 ` Jaewon Kim
2022-04-06 9:48 ` Jiri Slaby
2022-04-06 11:19 ` Jaewon Kim
2022-04-06 11:21 ` Jiri Slaby
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='001601d848b8$10c97490$325c5db0$@samsung.com' \
--to=jaewon02.kim@samsung.com \
--cc=alim.akhtar@samsung.com \
--cc=chanho61.park@samsung.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).