All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: John Ernberg <john.ernberg@actia.se>
Cc: Edwin Thankachan <Edwin.Thankachan@electrifex.com>,
	 "xen-devel@lists.xenproject.org"
	<xen-devel@lists.xenproject.org>,
	 Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>,
	 Bertrand Marquis <bertrand.marquis@arm.com>,
	 Michal Orzel <michal.orzel@amd.com>,
	 "Volodymyr_Babchuk@epam.com" <volodymyr_babchuk@epam.com>
Subject: Re: [PATCH] drivers/char: imx-lpuart: use interrupt-driven transmit
Date: Thu, 3 Dec 2026 17:17:14 -0800 (PST)	[thread overview]
Message-ID: <1396faec-5c81-1ae5-9d17-b7b7624bb5ee@kernel.org> (raw)
In-Reply-To: <4761919c-cea4-4edc-8465-4afa04de4885@actia.se>

On Thu, 3 Dec 2026, John Ernberg wrote:
> Hi Edwin,
> 
> On 03/12/2026 07:45, Edwin Thankachan wrote:
> > The driver handles the TX interrupt but never calls
> > serial_async_transmit(), so every console character is written
> > synchronously. serial_puts() holds the port's tx_lock with interrupts
> > disabled meanwhile. Each console line therefore keeps a CPU spinning
> > with interrupts off until it has been transmitted, which takes about
> > 5 ms for a 60-character line at 115200 baud.
> > 
> > Call serial_async_transmit() once the interrupt is set up, as ns16550
> > does, so printk() only queues characters and the TX interrupt drains
> > the buffer.
> > 
> > This requires ->tx_ready() to return the number of characters the port
> > can accept, as the serial core expects. It returns the raw UARTSTAT_TC
> > bit instead, which serial_tx_interrupt() would take as a count of
> > 4194304 characters. Return 1 when TDRE is set, which is also what
> > ->putc() waits for.
> > 
> > Fixes: 44e17aa60d47 ("xen/arm: Add i.MX lpuart driver")
> > Signed-off-by: Edwin Thankachan <edwin.thankachan@electrifex.com>
> > ---
> > Tested on an i.MX95 board (Xen 4.21 based tree, which adds an i.MX95
> > compatible entry): Xen, dom0 and three domUs boot.
> > Build-tested on staging for arm64.
> > 
> > Example of the stall: with guest_loglvl=all, each
> > XEN_DOMCTL_memory_mapping call logs one line. Timing the dom0 privcmd
> > ioctl over 16 s, the call took 5.66 ms (median) before this patch and
> > 0.071 ms after.
> > 
> > One interrupt per character is enough for a console; using the TX FIFO
> > depth in ->tx_ready() could follow separately. When the transmit buffer
> > overflows, characters are dropped instead of stalling the CPU, as with
> > the other interrupt-driven UART drivers; "sync_console" keeps the old
> > behaviour.
> > 
> >   xen/drivers/char/imx-lpuart.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/xen/drivers/char/imx-lpuart.c b/xen/drivers/char/imx-lpuart.c
> > index cf034d7ed062..469d791894bd 100644
> > --- a/xen/drivers/char/imx-lpuart.c
> > +++ b/xen/drivers/char/imx-lpuart.c
> > @@ -98,13 +98,15 @@
> >       temp |= (UARTCTRL_RIE | UARTCTRL_TIE);
> >       temp |= UARTCTRL_ILIE;
> >       imx_lpuart_write(uart, UARTCTRL, temp);
> > +
> > +    serial_async_transmit(port);
> >   }
> > 
> >   static int imx_lpuart_tx_ready(struct serial_port *port)
> >   {
> >       struct imx_lpuart *uart = port->uart;
> > 
> > -    return imx_lpuart_read(uart, UARTSTAT) & UARTSTAT_TC;
> > +    return !!(imx_lpuart_read(uart, UARTSTAT) & UARTSTAT_TDRE);
> >   }
> > 
> >   static void imx_lpuart_putc(struct serial_port *port, char c)
> > 
> > base-commit: 0f5037b465b647428b66ba2d413f44315d5b97d0
> 
> I'm a bit short on time this week, I'll have a proper look at it early next
> week.

The patch looks good to me, but I'd prefer to wait for John to have a
chance to review it


      reply	other threads:[~2026-12-04  1:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  6:45 [PATCH] drivers/char: imx-lpuart: use interrupt-driven transmit Edwin Thankachan
2026-12-03  8:00 ` Mykyta Poturai
2026-12-03  8:21 ` John Ernberg
2026-12-04  1:17   ` Stefano Stabellini [this message]

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=1396faec-5c81-1ae5-9d17-b7b7624bb5ee@kernel.org \
    --to=sstabellini@kernel.org \
    --cc=Edwin.Thankachan@electrifex.com \
    --cc=bertrand.marquis@arm.com \
    --cc=john.ernberg@actia.se \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=volodymyr_babchuk@epam.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.