From: Jiri Slaby <jirislaby@kernel.org>
To: Yicong Yang <yangyicong@huawei.com>,
gregkh@linuxfoundation.org, tony@atomide.com,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: john.ogness@linutronix.de, andriy.shevchenko@linux.intel.com,
tglx@linutronix.de, yangyicong@hisilicon.com,
linuxarm@huawei.com, prime.zeng@hisilicon.com,
jonathan.cameron@huawei.com, fanghao11@huawei.com
Subject: Re: [PATCH v3] serial: port: Don't suspend if the port is still busy
Date: Thu, 8 Feb 2024 09:27:57 +0100 [thread overview]
Message-ID: <beb599e2-ebc5-4b26-82c3-908830effd5a@kernel.org> (raw)
In-Reply-To: <20240208075216.48915-1-yangyicong@huawei.com>
Hi,
On 08. 02. 24, 8:52, Yicong Yang wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
>
> We accidently met the issue that the bash prompt is not shown after the
> previous command done and until the next input if there's only one CPU
> (In our issue other CPUs are isolated by isolcpus=). Further analysis
> shows it's because the port entering runtime suspend even if there's
> still pending chars in the buffer and the pending chars will only be
> processed in next device resuming. We are using amba-pl011 and the
> problematic flow is like below:
...
> --- a/drivers/tty/serial/serial_port.c
> +++ b/drivers/tty/serial/serial_port.c
> @@ -19,8 +19,13 @@
> /* Only considers pending TX for now. Caller must take care of locking */
> static int __serial_port_busy(struct uart_port *port)
> {
> - return !uart_tx_stopped(port) &&
> - uart_circ_chars_pending(&port->state->xmit);
> + if (uart_tx_stopped(port))
> + return 0;
> +
> + if (uart_circ_chars_pending(&port->state->xmit))
> + return -EBUSY;
Why do you do this change at all? If anything, __serial_port_busy()
should be made to return a bool and not to return an error. Look how it
is named -- returning EBUSY is sort of unexpected in my eyes. And if
this needed to be done, it should have been in a separate patch anyway.
And then:
> @@ -46,8 +51,33 @@ static int serial_port_runtime_resume(struct device *dev)
> return 0;
> }
>
> +static int serial_port_runtime_suspend(struct device *dev)
> +{
> + struct serial_port_device *port_dev = to_serial_base_port_device(dev);
> + struct uart_port *port;
> + unsigned long flags;
> + int ret;
bool busy;
> +
> + port = port_dev->port;
> +
> + if (port->flags & UPF_DEAD)
> + return 0;
> +
> + uart_port_lock_irqsave(port, &flags);
> + ret = __serial_port_busy(port);
> + if (ret)
busy = ...
if (busy)
> + port->ops->start_tx(port);
> + uart_port_unlock_irqrestore(port, flags);
> +
> + if (ret)
if (busy)
> + pm_runtime_mark_last_busy(dev);
> +
> + return ret;
return busy ? -EBUSY : 0;
> +}
thanks,
--
js
suse labs
next prev parent reply other threads:[~2024-02-08 8:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 7:52 Yicong Yang
2024-02-08 8:13 ` Tony Lindgren
2024-02-08 8:27 ` Jiri Slaby [this message]
2024-02-08 17:25 ` Andy Shevchenko
2024-02-22 9:41 ` Yicong Yang
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=beb599e2-ebc5-4b26-82c3-908830effd5a@kernel.org \
--to=jirislaby@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=fanghao11@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=prime.zeng@hisilicon.com \
--cc=tglx@linutronix.de \
--cc=tony@atomide.com \
--cc=yangyicong@hisilicon.com \
--cc=yangyicong@huawei.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
all inboxes | Powered by JetHome®