From: Jiri Slaby <jirislaby@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Elen Song <elen.song@atmel.com>
Cc: Richard Genoud <richard.genoud@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Ludovic Desroches <ludovic.desroches@atmel.com>,
linux-serial@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] serial: atmel: don't enable IRQs prematurely
Date: Mon, 19 Jun 2023 13:01:49 +0200 [thread overview]
Message-ID: <d87d9f00-8d85-6220-43d3-51ef8e793193@kernel.org> (raw)
In-Reply-To: <cb7c39a9-c004-4673-92e1-be4e34b85368@moroto.mountain>
On 19. 06. 23, 11:45, Dan Carpenter wrote:
> The atmel_complete_tx_dma() function disables IRQs at the start
> of the function by calling spin_lock_irqsave(&port->lock, flags);
> There is no need to disable them a second time using the
> spin_lock_irq() function and, in fact, doing so is a bug because
> it will enable IRQs prematurely when we call spin_unlock_irq().
>
> Just use spin_lock/unlock() instead without disabling or enabling
> IRQs.
>
> Fixes: 08f738be88bb ("serial: at91: add tx dma support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/tty/serial/atmel_serial.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 6e9192f122aa..3467a875641a 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -868,11 +868,11 @@ static void atmel_complete_tx_dma(void *arg)
> dmaengine_terminate_all(chan);
> uart_xmit_advance(port, atmel_port->tx_len);
>
> - spin_lock_irq(&atmel_port->lock_tx);
> + spin_lock(&atmel_port->lock_tx);
> async_tx_ack(atmel_port->desc_tx);
> atmel_port->cookie_tx = -EINVAL;
> atmel_port->desc_tx = NULL;
> - spin_unlock_irq(&atmel_port->lock_tx);
> + spin_unlock(&atmel_port->lock_tx);
Hmm, can you ensure the DMA engine code calls this with irqs disabled?
If so, you should document it in the commit log. If not, you shyuld use
_irqsave() variant.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2023-06-19 11:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-19 9:45 [PATCH] serial: atmel: don't enable IRQs prematurely Dan Carpenter
2023-06-19 11:01 ` Jiri Slaby [this message]
2023-06-19 11:44 ` Dan Carpenter
2023-06-19 11:47 ` Dan Carpenter
2023-06-20 4:50 ` Jiri Slaby
2023-06-21 8:19 ` Richard Genoud
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=d87d9f00-8d85-6220-43d3-51ef8e793193@kernel.org \
--to=jirislaby@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@microchip.com \
--cc=dan.carpenter@linaro.org \
--cc=elen.song@atmel.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=ludovic.desroches@atmel.com \
--cc=nicolas.ferre@microchip.com \
--cc=richard.genoud@gmail.com \
/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