Re: [PATCH v4 2/2] xen/console: add compile-time rate-limiting controls
[email protected] Mon, 10 Aug 2026 10:56:15 -0700
Newsgroups
gmane.comp.emulators.xen.devel
Message-ID
<anoQv9sWca/mLWQR@kraken>
On Mon, Aug 10, 2026 at 03:06:35PM +0200, Roger Pau Monné wrote:
> On Wed, Jul 29, 2026 at 12:25:20AM -0700, [email protected] wrote:
> > 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 v3:
> > - added note on security support for non-standard configurations
> > - gated menu with EXPERT
> >
> > I kept both settings for now.
> > ---
> > xen/common/Kconfig | 36 ++++++++++++++++++++++++++++++++++++
> > xen/drivers/char/console.c | 6 ++++--
> > 2 files changed, 40 insertions(+), 2 deletions(-)
> >
> > diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> > index da80fdba8469..749d3bfb08e0 100644
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -672,4 +672,40 @@ 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"
> > + visible if EXPERT
>
> No strong opinion, but there's a drivers/char/Kconfig which might be a
> more natural place for those option to live, and then there's no
> reason for the extra menu?
I had the knob initially in drivers/char/Kconfig, but moved to
common/Kconfig to address Jan's feedback:
https://lore.kernel.org/xen-devel/[email protected] /
>
> > +
> > +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.
> > +
> > + Configurations using a value other than the default of 5000 are not
> > + security supported.
> > +
> > + [*] 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.
> > +
> > + Configurations using a value other than the default of 10 are not
> > + security supported.
> > +
> > + [*] Rate-limited messages are those controlled by the `loglvl` and
> > + `guest_loglvl` command-line parameters.
>
> Is it common to use footnotes in Kconfig options? It seems a bit
> weird to me, I would probably just expand inside parenthesis if
> needed.
I'll just drop extra text.
>
> Also, I'm a bit confused by the mention of loglvl and guest_loglvl
> explicitly here: messages outside of the selected level are just
> discarded, and hence it's kind of obvious that just messages inside
> the selected level are controlled by this rate-limiting.