public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	 linux-serial <linux-serial@vger.kernel.org>,
	 qianfan Zhao <qianfanguijin@163.com>,
	Adriana Nicolae <adriana@arista.com>,
	 LKML <linux-kernel@vger.kernel.org>,
	 "Bandal, Shankar" <shankar.bandal@intel.com>,
	 "Murthy, Shanth" <shanth.murthy@intel.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 4/7] serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling
Date: Wed, 28 Jan 2026 16:00:14 +0200 (EET)	[thread overview]
Message-ID: <f050a630-8732-346e-0f5f-0186e5640c30@linux.intel.com> (raw)
In-Reply-To: <aXoTnKJjwO5_GMoL@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2410 bytes --]

On Wed, 28 Jan 2026, Andy Shevchenko wrote:

> On Wed, Jan 28, 2026 at 12:52:58PM +0200, Ilpo Järvinen wrote:
> > dw8250_handle_irq() takes port's lock multiple times with no good
> > reason to release it in between and calls serial8250_handle_irq()
> > that also takes port's lock.
> > 
> > Take port's lock only once in dw8250_handle_irq() and use
> > serial8250_handle_irq_locked() to avoid releasing port's lock in
> > between.
> > 
> > As IIR_NO_INT check in serial8250_handle_irq() was outside of port's
> > lock, it has to be done already in dw8250_handle_irq().
> > 
> > DW UART can, in addition to IIR_NO_INT, report BUSY_DETECT (0x7) which
> > collided with the IIR_NO_INT (0x1) check in serial8250_handle_irq()
> > (because & is used instead of ==) meaning that no other work is done by
> > serial8250_handle_irq() during an BUSY_DETECT interrupt.
> > 
> > This allows reorganizing code in dw8250_handle_irq() to do both
> > IIR_NO_INT and BUSY_DETECT handling right at the start simplifying
> > the logic.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> ...
> 
> >  	if (!up->dma && rx_timeout) {
> >  		status = serial_lsr_in(up);
> >  
> >  		if (!(status & (UART_LSR_DR | UART_LSR_BI)))
> >  			serial_port_in(p, UART_RX);
> >  	}
> >  
> >  	/* Manually stop the Rx DMA transfer when acting as flow controller */
> >  	if (quirks & DW_UART_QUIRK_IS_DMA_FC && up->dma && up->dma->rx_running && rx_timeout) {
> >  		status = serial_lsr_in(up);
> >  
> >  		if (status & (UART_LSR_DR | UART_LSR_BI)) {
> >  			dw8250_writel_ext(p, RZN1_UART_RDMACR, 0);
> 			...
> >  		}
> >  	}
> 
> Looks like now (perhaps in a separate change) this may be refactored even more.

Definitely, as was noted in the coverletter. ;-)

--
 i.

> 
> 	if (rx_timeout) {
> 		status = serial_lsr_in(up);
> 
> // Although not sure about moving the above read out from the specific conditions.
> 
> 		if (up->dma && (status & (UART_LSR_DR | UART_LSR_BI))) {
> 			/* Manually stop the Rx DMA transfer when acting as flow controller */
> 			if (quirks & DW_UART_QUIRK_IS_DMA_FC && up->dma->rx_running) {
> 				dw8250_writel_ext(p, RZN1_UART_RDMACR, 0);
> 				dw8250_writel_ext(p, DW_UART_DMASA, 1);
> 		} else if (!up->dma && !(status & (UART_LSR_DR | UART_LSR_BI)))
> 			/* ... */
> 			serial_port_in(p, UART_RX);
> 		}
> 	}
> 
> 

  reply	other threads:[~2026-01-28 14:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260128105301.1869-1-ilpo.jarvinen@linux.intel.com>
2026-01-28 10:52 ` [PATCH v2 1/7] serial: 8250: Protect LCR write in shutdown Ilpo Järvinen
2026-01-28 13:12   ` Andy Shevchenko
2026-01-28 10:52 ` [PATCH v2 2/7] serial: 8250_dw: Avoid unnecessary LCR writes Ilpo Järvinen
2026-01-28 13:36   ` Andy Shevchenko
2026-01-28 10:52 ` [PATCH v2 3/7] serial: 8250: Add serial8250_handle_irq_locked() Ilpo Järvinen
2026-01-28 13:20   ` Andy Shevchenko
2026-01-28 13:26     ` Ilpo Järvinen
2026-01-28 10:52 ` [PATCH v2 4/7] serial: 8250_dw: Rework dw8250_handle_irq() locking and IIR handling Ilpo Järvinen
2026-01-28 13:48   ` Andy Shevchenko
2026-01-28 14:00     ` Ilpo Järvinen [this message]
2026-01-28 10:52 ` [PATCH v2 5/7] serial: 8250_dw: Rework IIR_NO_INT handling to stop interrupt storm Ilpo Järvinen
2026-01-28 14:03   ` Andy Shevchenko
2026-01-28 10:53 ` [PATCH v2 6/7] serial: 8250: Add late synchronize_irq() to shutdown to handle DW UART BUSY Ilpo Järvinen
2026-01-28 14:37   ` Andy Shevchenko
2026-01-28 15:07     ` Ilpo Järvinen
2026-01-28 10:53 ` [PATCH v2 7/7] serial: 8250_dw: Ensure BUSY is deasserted Ilpo Järvinen
2026-01-28 15:42   ` Andy Shevchenko
2026-01-30 12:44     ` Ilpo Järvinen

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=f050a630-8732-346e-0f5f-0186e5640c30@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=adriana@arista.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=qianfanguijin@163.com \
    --cc=shankar.bandal@intel.com \
    --cc=shanth.murthy@intel.com \
    --cc=stable@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