From: Jiri Slaby <jirislaby@kernel.org>
To: Peng Zhang <zhangpeng.00@bytedance.com>, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
songmuchun@bytedance.com,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
buytenh@arista.com,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH] serial: 8250: always disable IRQ during THRE test
Date: Wed, 15 Oct 2025 17:49:34 +0200 [thread overview]
Message-ID: <0eb4c357-aafd-42bd-a4fd-687a91831bf4@kernel.org> (raw)
In-Reply-To: <94d19d6d-5bb5-4156-8499-0be3d227f478@bytedance.com>
On 14. 10. 25, 14:19, Peng Zhang wrote:
>
>
> 在 2025/10/14 19:47, Peng Zhang 写道:
>> commit 039d4926379b ("serial: 8250: Toggle IER bits on only after irq
>> has been set up") moved IRQ setup before the THRE test, so the interrupt
>> handler can run during the test and race with its IIR reads. This can
>> produce wrong THRE test results and cause spurious registration of the
>> serial8250_backup_timeout timer. Unconditionally disable the IRQ for the
>> short duration of the test and re-enable it afterwards to avoid the race.
>>
>> Fixes: 039d4926379b ("serial: 8250: Toggle IER bits on only after irq
>> has been set up")
>> Signed-off-by: Peng Zhang <zhangpeng.00@bytedance.com>
>> ---
>> drivers/tty/serial/8250/8250_port.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/
>> serial/8250/8250_port.c
>> index 719faf92aa8a..addeef7a0d59 100644
>> --- a/drivers/tty/serial/8250/8250_port.c
>> +++ b/drivers/tty/serial/8250/8250_port.c
>> @@ -2147,8 +2147,7 @@ static void serial8250_THRE_test(struct
>> uart_port *port)
>> if (up->port.flags & UPF_NO_THRE_TEST)
>> return;
>> - if (port->irqflags & IRQF_SHARED)
>> - disable_irq_nosync(port->irq);
>> + disable_irq_nosync(port->irq);
> disable_irq_nosync() may need to be changed to disable_irq() to prevent
> interrupts that are currently being handled.
Make sense to me. Care to Cc the people from 039d4926379b next time, so
that they can comment?
>> /*
>> * Test for UARTs that do not reassert THRE when the transmitter
>> is idle and the interrupt
>> @@ -2170,8 +2169,7 @@ static void serial8250_THRE_test(struct
>> uart_port *port)
>> serial_port_out(port, UART_IER, 0);
>> }
>> - if (port->irqflags & IRQF_SHARED)
>> - enable_irq(port->irq);
>> + enable_irq(port->irq);
>> /*
>> * If the interrupt is not reasserted, or we otherwise don't
>> trust the iir, setup a timer to
>
--
js
suse labs
next prev parent reply other threads:[~2025-10-15 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 11:47 [PATCH] serial: 8250: always disable IRQ during THRE test Peng Zhang
2025-10-14 12:19 ` Peng Zhang
2025-10-15 15:49 ` Jiri Slaby [this message]
2025-10-18 18:56 ` Andy Shevchenko
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=0eb4c357-aafd-42bd-a4fd-687a91831bf4@kernel.org \
--to=jirislaby@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=buytenh@arista.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=songmuchun@bytedance.com \
--cc=zhangpeng.00@bytedance.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;
as well as URLs for NNTP newsgroup(s).