mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Jaewon Kim <jaewon02.kim@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alim Akhtar <alim.akhtar@samsung.com>,
	linux-samsung-soc@vger.kernel.org
Cc: 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 v3 1/1] tty: serial: samsung: add spin_lock for interrupt and console_write
Date: Thu, 7 Apr 2022 09:46:46 +0200	[thread overview]
Message-ID: <b53be23f-7935-dae3-9dc8-f850493a5fa9@kernel.org> (raw)
In-Reply-To: <20220407071619.102249-2-jaewon02.kim@samsung.com>

On 07. 04. 22, 9:16, 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.

 From the patch POV:

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

But given this is a v3 with no version changelog below "---", you've 
just kicked the Greg's bot to wake up :P.

> Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
> ---
>   drivers/tty/serial/samsung_tty.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/tty/serial/samsung_tty.c b/drivers/tty/serial/samsung_tty.c
> index e1585fbae909..8af5aceb9f4e 100644
> --- a/drivers/tty/serial/samsung_tty.c
> +++ b/drivers/tty/serial/samsung_tty.c
> @@ -2480,12 +2480,24 @@ 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;
> +	bool locked = true;
>   
>   	/* not possible to xmit on unconfigured port */
>   	if (!s3c24xx_port_configured(ucon))
>   		return;
>   
> +	if (cons_uart->sysrq)
> +		locked = false;
> +	else if (oops_in_progress)
> +		locked = spin_trylock_irqsave(&cons_uart->lock, flags);
> +	else
> +		spin_lock_irqsave(&cons_uart->lock, flags);
> +
>   	uart_console_write(cons_uart, s, count, s3c24xx_serial_console_putchar);
> +
> +	if (locked)
> +		spin_unlock_irqrestore(&cons_uart->lock, flags);
>   }
>   
>   /* Shouldn't be __init, as it can be instantiated from other module */


-- 
js
suse labs

  reply	other threads:[~2022-04-07  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20220407071223epcas2p2f25428844528dbd505d1b49e0778133d@epcas2p2.samsung.com>
2022-04-07  7:16 ` [PATCH v3 0/1] tty: serial: samsung: add spin_lock in console_write Jaewon Kim
     [not found]   ` <CGME20220407071223epcas2p16bb11821a0894a3375e84d17c4ff0844@epcas2p1.samsung.com>
2022-04-07  7:16     ` [PATCH v3 1/1] tty: serial: samsung: add spin_lock for interrupt and console_write Jaewon Kim
2022-04-07  7:46       ` Jiri Slaby [this message]
2022-04-07  7:58         ` Krzysztof Kozlowski
2022-04-07  8:05           ` 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=b53be23f-7935-dae3-9dc8-f850493a5fa9@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=alim.akhtar@samsung.com \
    --cc=chanho61.park@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jaewon02.kim@samsung.com \
    --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

all inboxes | Powered by JetHome®