|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 4/7] xen/console: add run-time rate-limiting controls
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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |