Re: [PATCH v3 3/4] xen/console: add build-time rate-limiting controls

[email protected]
Newsgroups org.xenproject.lists.xen-devel
Message-ID <alrmP1FHd7AzlBxC@kraken>
On Thu, Jul 16, 2026 at 11:59:34AM +0200, Teddy Astie wrote:
> Le 15/07/2026 à 22:24, [email protected] a écrit :
> > From: Denis Mukhin <[email protected]>
> > 
> > Introduce CONFIG_PRINTK_RATELIMIT_MS and CONFIG_PRINTK_RATELIMIT_BURST
> > for configuring rate-limiting policy at the compile time.
> > 
> > Use symbols for global rate-limiting initialization in the console driver.
> > 
> > Signed-off-by: Denis Mukhin <[email protected]>
> > ---
> > Changes since v2:
> > - moved rate-limiting controls to common/Kconfig
> > ---
> >   xen/common/Kconfig         | 29 +++++++++++++++++++++++++++++
> >   xen/drivers/char/console.c |  6 ++++--
> >   2 files changed, 33 insertions(+), 2 deletions(-)
> > 
> > diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> > index da80fdba8469..fd22806884e0 100644
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -672,4 +672,33 @@ config PM_STATS
> >   	  Enable collection of performance management statistics to aid in
> >   	  analyzing and tuning power/performance characteristics of the system
> > +menu "Console rate-limiting"
> > +
> > +config PRINTK_RATELIMIT_MS
> > +	int "printk rate-limiting time window (milliseconds)"
> > +	default 5000
> > +	help
> > +	  Specifies the time window, in milliseconds, for rate-limited printk
> > +	  messages. No more than `CONFIG_PRINTK_RATELIMIT_BURST` messages will be
> > +	  printed within this window.
> > +
> > +	  Setting this value to 0 disables rate-limiting entirely.
> > +
> > +	  Rate-limited messages are those controlled by the `loglvl` and
> > +	  `guest_loglvl` command-line parameters.
> > +
> > +config PRINTK_RATELIMIT_BURST
> > +	int "printk rate-limited message burst size"
> > +	default 10
> > +	help
> > +	  Defines the maximum number of rate-limited printk messages that may be
> > +	  printed within each `CONFIG_PRINTK_RATELIMIT_MS` time window.
> > +
> > +	  Setting this value to 0 disables rate-limiting entirely.
> > +
> > +	  Rate-limited messages are those controlled by the `loglvl` and
> > +	  `guest_loglvl` command-line parameters.
> > +
> > +endmenu
> > +
> >   endmenu
> 
> Given that setting 0 to either will disable rate limiting, would it be
> preferable instead to have a more general PRINTK_RATELIMIT toggle, where :
> 
> Setting it to true would enable configuration of ms and burst (rejecting 0
> if possible).
> Setting it to false would set both to 0 hence disabling rate limiting by
> default.
> 
> And we do something like
> 
> static const unsigned int printk_ratelimit_ms =
>   IS_ENABLED(CONFIG_PRINTK_RATELIMIT) ? CONFIG_PRINTK_RATELIMIT_MS : 0;
> 
> (similarly for burst)
> 
> ?

I can hide both selectors behind CONFIG_PRINTK_RATELIMIT.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.