Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Michael Pratt <mcpratt@pm.me>
Cc: LKML <linux-kernel@vger.kernel.org>,
	 linux-serial <linux-serial@vger.kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	 Wander Lairson Costa <wander@redhat.com>,
	 Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	 Vamshi Gajjela <vamshigajjela@google.com>
Subject: Re: [PATCH v2 1/3] serial: core: Store fifo timeout again
Date: Wed, 17 Apr 2024 10:52:48 +0300 (EEST)	[thread overview]
Message-ID: <3355ac64-56d6-af6c-cc7a-03fa4f143db4@linux.intel.com> (raw)
In-Reply-To: <20240416182741.22514-2-mcpratt@pm.me>

On Tue, 16 Apr 2024, Michael Pratt wrote:

> This is a partial revert of Commit f9008285bb69
> ("serial: Drop timeout from uart_port").
> 
> In order to prevent having to calculate a timeout
> for the fifo device during a write operation, if enabled,
> calculate it ahead of time and store the value of the timeout
> in a struct member of uart_port.

Hi,

Why is calculating during write bad/wrong, you don't give any real 
justification for this change? You're talking about "low rates" in cover 
letter, which makes it even more confusing because writes occur very 
infrequently so a few math operations are nothing to be concerned of (in 
timescales UARTs operate in, no math penalty is really worth even 
discussing IMO).

-- 
 i.

> Signed-off-by: Michael Pratt <mcpratt@pm.me>
> ---
> V1 -> V2: new commit
> 
>  drivers/tty/serial/serial_core.c | 3 +++
>  include/linux/serial_core.h      | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index ff85ebd3a007..9b3176d684a4 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -414,6 +414,9 @@ uart_update_timeout(struct uart_port *port, unsigned int cflag,
>  
>  	temp *= NSEC_PER_SEC;
>  	port->frame_time = (unsigned int)DIV64_U64_ROUND_UP(temp, baud);
> +
> +	if (port->fifosize > 1)
> +		port->timeout = uart_fifo_timeout(port);
>  }
>  EXPORT_SYMBOL(uart_update_timeout);
>  
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index 0a0f6e21d40e..c6422021152f 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -561,6 +561,7 @@ struct uart_port {
>  
>  	bool			hw_stopped;		/* sw-assisted CTS flow state */
>  	unsigned int		mctrl;			/* current modem ctrl settings */
> +	unsigned long		timeout;		/* character-based timeout */
>  	unsigned int		frame_time;		/* frame timing in ns */
>  	unsigned int		type;			/* port type */
>  	const struct uart_ops	*ops;
> 

  parent reply	other threads:[~2024-04-17  7:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 18:28 [PATCH v2 0/3] serial: 8250: Set fifo timeout with uart_fifo_timeout() Michael Pratt
2024-04-16 18:29 ` [PATCH v2 1/3] serial: core: Store fifo timeout again Michael Pratt
2024-04-16 18:58   ` Andy Shevchenko
2024-04-16 19:20     ` Michael Pratt
2024-04-17  8:18       ` Ilpo Järvinen
2024-04-17 15:41       ` Wander Lairson Costa
2024-04-17  7:52   ` Ilpo Järvinen [this message]
2024-04-16 18:29 ` [PATCH v2 2/3] serial: 8250: Store whether fifo device is enabled Michael Pratt
2024-04-16 18:55   ` Andy Shevchenko
2024-04-16 19:09     ` Michael Pratt
2024-04-16 19:18       ` Andy Shevchenko
2024-04-16 19:40         ` Michael Pratt
2024-04-16 18:34 ` [PATCH v2 3/3] serial: 8250: Set fifo timeout using uart_fifo_timeout() Michael Pratt
2024-04-16 18:57   ` Andy Shevchenko
2024-04-16 19:15     ` Michael Pratt
2024-04-17  8:13       ` Ilpo Järvinen
2024-04-17  8:00   ` 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=3355ac64-56d6-af6c-cc7a-03fa4f143db4@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.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=mcpratt@pm.me \
    --cc=vamshigajjela@google.com \
    --cc=wander@redhat.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