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

[PATCH v2 4/7] xen/console: add run-time rate-limiting controls


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Fri, 6 Feb 2026 12:24:21 -0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 205.220.161.53) 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=iG5bdruXvwjOkGeq9u+92H+E2bXW726qNCD/5wDXq9c=; b=HMODNjtLbZ2AUyWb91UJLBz/bxKxgwscLQnvR06G7dkI5u7ULQ7/GRAxyyXaIxtgfj2x198Bxa8D2m0OgD3RBUV5y3gwpk90aYwGhYTIs7MzsxK2EG+fN9G4oUVms43jKZyxEAXmI4hB8Cc3JMmGEI4fomTiCeYrEJrEcYAHTNurMNhDj1VWWK8tzOxsYyjI/E2M3T+4Em71MLZb+YEyMhKL0p9/Q6DDAJ55YY4LRBowFh/pLuwiLZ16kluSuGJlW2pNxE8+7Nthvk4svTZecFizn9LUFMGDVgFS4isE+XFzoehES7xMYn4kVn4R1XlY2VEhGVOUP5HYPvdO8zPjOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=elbmEeoOEO7Tn+r7I2VAPJx/h4Qx9oANUnyNbVYq131zY/RFOCwMxFYNlaeNCXS7kptxb2LJWfmlCCqfndWso9s8kZIzD924vG3wOz1M7DwY9iNzS/a/IHeZSBdNgRvQETtnoAFNwroA5iAFD9bc+LWmPOzyCDPDs8BOavwo7CNqqR3umo4xyQYHZiQ8RBkeSs3pJmcjcJwISNiixCEqgHrRqIEC0L4uEjG//WAE+Y5r11FprCIdGb4T6NxEarMJQh/J+5Klz16SMNVmQQoaSMd3SBmue6TDihtgswvz2rIYCTxpXlknmFUByGL++SYN45D6HiwNo2cvwAtGqGkIDQ==
  • 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:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Pser-m365-app: SER-APP

From: Denis Mukhin <dmukhin@xxxxxxxx> 

Add new "printk_ratelimit_ms" and "printk_ratelimit_burst" command line
parameters for global rate-limiting controls.

Drop `const` and add `__read_mostly` for both global parameters
printk_ratelimit_{ms,burst}.

Update command line documentation.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
Changes since v1:
- new patch
---
 docs/misc/xen-command-line.pandoc | 27 +++++++++++++++++++++++++++
 xen/drivers/char/console.c        | 22 ++++++++++++++--------
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc 
b/docs/misc/xen-command-line.pandoc
index c1f2def9f99c..5505644d1c0f 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2077,6 +2077,33 @@ compression is selected at build time from Kconfig.
 This is a mask of C-states which are to be used preferably.  This option is
 applicable only on hardware were certain C-states are exclusive of one another.
 
+### printk_ratelimit_ms
+> `= <integer>`
+
+> Default: `CONFIG_PRINTK_RATELIMIT_MS`
+
+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.
+
+### printk_ratelimit_burst
+> `= <integer>`
+
+> Default: `CONFIG_PRINTK_RATELIMIT_BURST`
+
+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.
+
 ### probe-port-aliases (x86)
 > `= <boolean>`
 
diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index ec87ecb3e5a0..f607e8f84d7a 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -344,6 +344,20 @@ static void cf_check do_dec_thresh(unsigned char key, bool 
unused)
     do_adj_thresh(key);
 }
 
+/*
+ * Global rate-limiting controls for printk().
+ */
+
+/* Minimum time in ms between messages */
+static unsigned int __read_mostly printk_ratelimit_ms =
+    CONFIG_PRINTK_RATELIMIT_MS;
+integer_param("printk_ratelimit_ms", printk_ratelimit_ms);
+
+/* Number of messages we send before ratelimiting */
+static unsigned int __read_mostly printk_ratelimit_burst =
+    CONFIG_PRINTK_RATELIMIT_BURST;
+integer_param("printk_ratelimit_burst", printk_ratelimit_burst);
+
 /*
  * ********************************************************
  * *************** ACCESS TO CONSOLE RING *****************
@@ -1320,14 +1334,6 @@ static bool do_printk_ratelimit(unsigned int 
ratelimit_ms,
     return false;
 }
 
-/* Minimum time in ms between messages */
-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 =
-    CONFIG_PRINTK_RATELIMIT_BURST;
-
 bool printk_ratelimit(void)
 {
     return do_printk_ratelimit(printk_ratelimit_ms, printk_ratelimit_burst);
-- 
2.52.0




 


Rackspace

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