[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 3/7] xen/console: add build-time rate-limiting controls


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Fri, 6 Feb 2026 12:24:20 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 148.163.138.245) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W0zvrbxd65Dho5s7fjUyTHQ6fvgLtTPnG+rL6EKOBJI=; b=c89xKPemlmCyE7i8GJFVpxbzFgWlRJLpBt3xIdVV3ftEscBPURzf5qU68wQEK96DomlIC/y2V5ybYeJDrJeIzW/f4pBah+bbHFAdZpBUpW6O2Tz8NwC7bN0dNXWLBIpbQA/oXkk8tR0qX4vOcXDFpGQVmtFG0wrH/mefOOY4fSYcig6TmjeAAGdVOyeIGo1ZqF6sFRLM9HHBpQWq9AbIt0RRka5KGlDlCb/G+HVbTG2qqNaVmgOAN7EdClM8uPympCnJaHE/elm6wtkiA71NeoqtVODe5tihiHi+MKmAyqF2gD+InW6rNkhTh5FcR3R4GIArDQocbJRDVoj0XKLp1A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VqqAlia7aIux2IAqssNBexRV0faNWi2XQX3YapLmKja6sKeiScBorohIDdIh8OJclapCuyjjm/G6+XEVjfUX1uXfrKEwkQLLS2Bhv3dO2zAM331gFl4T8K8QwP49TyJnATbkL+uQpSp3fD3HNcAiuMAcBxdwbuKTRAnZkhfpFfE3UbOx/kQuL2F422BK2qTjW2BhnEFzjAVrcBcywntiKL0dWBA7E935hfsFJmQbNawU/VN2C0AbrM5Cx8sW5CxacaIuFy2PMEgb9dtG0heoFnaQHxM/tLPpa7UbPjPOUuH01GXMiUYsigaZkB/CZcnehF7LrkJ8CMYoRReGcei0XA==
  • Cc: andrew.cooper3@xxxxxxxxxx, anthony.perard@xxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, michal.orzel@xxxxxxx, roger.pau@xxxxxxxxxx, sstabellini@xxxxxxxxxx, dmukhin@xxxxxxxx
  • Delivery-date: Fri, 06 Feb 2026 20:24:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx> 

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 <dmukhin@xxxxxxxx>
---
Changes since v1:
- new patch
---
 xen/drivers/char/Kconfig   | 25 +++++++++++++++++++++++++
 xen/drivers/char/console.c |  6 ++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 8e49a52c735b..98b117762a0c 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -103,3 +103,28 @@ config XHCI
          Enabling this option makes Xen use extra ~230KiB memory, even if XHCI 
UART
          is not selected.
          If you have an x86 based system with USB3, say Y.
+
+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.
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index c4c92e3efa39..ec87ecb3e5a0 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -1321,10 +1321,12 @@ static bool do_printk_ratelimit(unsigned int 
ratelimit_ms,
 }
 
 /* Minimum time in ms between messages */
-static const unsigned int printk_ratelimit_ms = 5 * 1000;
+static const unsigned int printk_ratelimit_ms =
+    CONFIG_PRINTK_RATELIMIT_MS;
 
 /* Number of messages we send before ratelimiting */
-static const unsigned int printk_ratelimit_burst = 10;
+static const unsigned int printk_ratelimit_burst =
+    CONFIG_PRINTK_RATELIMIT_BURST;
 
 bool printk_ratelimit(void)
 {
-- 
2.52.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.