[RFC PATCH 3/7] drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent

Jim Cromie posted 7 patches 1 month ago
[RFC PATCH 3/7] drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent
Posted by Jim Cromie 1 month ago
Ratelimiting these pr_debug()s can reduce the console flood during
bulk dynamic-debug activation, in environments where a serial console
is used.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 drivers/tty/serial/serial_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 487756947a96..6db465619c70 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1790,8 +1790,8 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
 
 	expire = jiffies + timeout;
 
-	pr_debug("uart_wait_until_sent(%u), jiffies=%lu, expire=%lu...\n",
-		port->line, jiffies, expire);
+	pr_debug_ratelimited("waiting on (%u) jiffies=%lu, expire=%lu...\n",
+			     port->line, jiffies, expire);
 
 	/*
 	 * Check whether the transmitter is empty every 'char_time'.
-- 
2.53.0
Re: [RFC PATCH 3/7] drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent
Posted by Jiri Slaby 1 month ago
On 06. 03. 26, 2:50, Jim Cromie wrote:
> Ratelimiting these pr_debug()s can reduce the console flood during
> bulk dynamic-debug activation, in environments where a serial console
> is used.
> 
> Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> ---
>   drivers/tty/serial/serial_core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 487756947a96..6db465619c70 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1790,8 +1790,8 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
>   
>   	expire = jiffies + timeout;
>   
> -	pr_debug("uart_wait_until_sent(%u), jiffies=%lu, expire=%lu...\n",
> -		port->line, jiffies, expire);
> +	pr_debug_ratelimited("waiting on (%u) jiffies=%lu, expire=%lu...\n",
> +			     port->line, jiffies, expire);

The changed message does not make any sense.


-- 
js
suse labs
Re: [RFC PATCH 3/7] drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent
Posted by jim.cromie@gmail.com 1 month ago
On Thu, Mar 5, 2026 at 11:32 PM Jiri Slaby <jirislaby@kernel.org> wrote:
>
> On 06. 03. 26, 2:50, Jim Cromie wrote:
> > Ratelimiting these pr_debug()s can reduce the console flood during
> > bulk dynamic-debug activation, in environments where a serial console
> > is used.
> >
> > Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
> > ---
> >   drivers/tty/serial/serial_core.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > index 487756947a96..6db465619c70 100644
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -1790,8 +1790,8 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
> >
> >       expire = jiffies + timeout;
> >
> > -     pr_debug("uart_wait_until_sent(%u), jiffies=%lu, expire=%lu...\n",
> > -             port->line, jiffies, expire);
> > +     pr_debug_ratelimited("waiting on (%u) jiffies=%lu, expire=%lu...\n",
> > +                          port->line, jiffies, expire);
>
> The changed message does not make any sense.
>

Ackn.  Given the narrow rate-limiting purpose,
I should have ignored the checkpatch warning
and kept the message as is.

In any case, my test setup didnt actually use serio,
and didnt get flooded by it, so I dont know that this
single change would be enough to fix it.

I withdraw this particular patch.

>
> --
> js
> suse labs