From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A707E606A322 for ; Fri, 4 Dec 2026 01:17:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hZsSS4X5 Received: from list by lists.xenproject.org with outflank-mailman.1513451.1705074 (Exim 4.92) (envelope-from ) id 1xZHvN-0008Ux-1Z; Fri, 04 Dec 2026 01:17:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1513451.1705074; Fri, 04 Dec 2026 01:17:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZHvM-0008Uq-U2; Fri, 04 Dec 2026 01:17:20 +0000 Received: by outflank-mailman (input) for mailman id 1513451; Fri, 04 Dec 2026 01:17:20 +0000 Received: from mx.expurgate.net ([195.190.135.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xZHvL-0008Uk-Uj for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 01:17:19 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xZHvL-00GRGJ-4I for xen-devel@lists.xenproject.org; Fri, 04 Dec 2026 02:17:19 +0100 Received: from [10.42.69.9] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6b12148c-e002-0a2a0a5209dd-0a2a450993c4-8 for ; Fri, 04 Dec 2026 02:17:19 +0100 Received: from [172.234.252.31] (helo=sea.source.kernel.org) by tlsNG-bad1c0.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6b12149d-be1a-0a2a45090019-aceafc1fb8dc-3 for ; Fri, 04 Dec 2026 02:17:18 +0100 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 8B7EC401A8; Fri, 4 Dec 2026 01:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28F241F00937; Fri, 4 Dec 2026 01:17:15 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=k20260515 header.d=kernel.org header.i="@kernel.org" header.h="Date:From:To:cc:Subject:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796347036; bh=P/DjiWarfNzr4al5rNB5j3aHc4C5TeThfV4X1A7MOD4=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=hZsSS4X5ODN2CZxTccthAlmZuUwvOmTBG5KXzyXGWYqPwvvBeATv7djYbZEgO4pQ3 XS27fp1o4wh+fpfGo0iFeLZ9zRrp6DnPNFLnBWopwoKb9/Lz/dZ4a1fTihQv2L/KcG N/t1FuuP3kVG9kJ6gAQR5mSS7B4dM9grYGstK4PDWuCw4UFrgseFZLfnK+tAvRXS0S 3qBmnUHeA3bLM8nl3dg/Ndso1dFRxnw4HhVip07zkj0QPyDlB5D4blOZUeImJdJ6LT RCKkqMi0mooZbLkN2AyMQ/vQj9mRkYYh9s2FMLUhFjIGnOY3LxSRDtHq9oxYrE/J7l CnmSVrbji0MZg== Date: Thu, 3 Dec 2026 17:17:14 -0800 (PST) From: Stefano Stabellini To: John Ernberg cc: Edwin Thankachan , "xen-devel@lists.xenproject.org" , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr_Babchuk@epam.com" Subject: Re: [PATCH] drivers/char: imx-lpuart: use interrupt-driven transmit In-Reply-To: <4761919c-cea4-4edc-8465-4afa04de4885@actia.se> Message-ID: <1396faec-5c81-1ae5-9d17-b7b7624bb5ee@kernel.org> References: <4761919c-cea4-4edc-8465-4afa04de4885@actia.se> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-purgate-ID: tlsNG-bad1c0/1796347039-FC212034-6F5B8F7B/0/0 X-purgate-type: clean X-purgate-size: 3013 X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 > > --- > > 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