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

[PATCH v2 1/7] xen/console: remove __printk_ratelimit() from lib.h


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: dmukhin@xxxxxxxx
  • Date: Fri, 6 Feb 2026 12:24:18 -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=ET+jvimhv0hTD8RcCXIsoFo2fNr0oqaiC0W5T80dNhk=; b=LksH4VI5X45NpIQAZi5wSjkFITiFGPR+eQ4VJ53I5FNS2V4CS7mWmS+KMVX5IIUF8Y4g8Z1CzweGnohc6KMtH0g0wE/mPkeHmP9Mbc/Gt7Gn3KqH5OX8AqItOQV8CZCpQDPO4QkKB+mLgOG0Iuwc26piq5BJAckPNRB+WYlDb+XRqvdDNTllmeudgkwNanO8wce+VWGcycODeSHB1DISDX2J45jR/teIrzBSaPuGfYhoZLn0UEGbl68pqmq6uFvvgDPtAMUYchKkwrSssf/F2Yrm0oA+NhV4SsiQGsPED2/2C+R529Zx4POCJy8DghlwyhANWeXRLh1D9ggPiqLT0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=la1hr4hTtfbe7e5SNMcliJIWPp7OXqxb+GJHjRaT2oRVhQ/IiSoaLEy9pjbRAFoN+qtkLFQtDm6mpW0MfaT48P3iJ3FLvF95ViOy+HgIeCXU2hFTH81KLfC8XDZuCXF4LJEicnSqUVMB9lgl27ibcfGHpSHAGVM65Xj/sNz9P/rT/5O2YfkOTUdjBLuZC8aqvBtkAu5nhsksVkakQpykgje8MzOwUURhCcyfR/gkUeRLPl8JwzHbeleiq/mzFFSuK1ZZ2/z1uEjDeZtFm8yrOIrre6Pxfgu64sxwpQIIvsHitvaKJscLqNp9/jYlENVmbgTZvEx4/3kPy74ns1g26w==
  • 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> 

There's no users of __printk_ratelimit() outside console driver.

Remove the declaration from lib.h header and make the function local to
console driver.

While doing it, drop double underscores to satisfy MISRA; rename function
to do_printk_ratelimit().

Not a functional change.

Signed-off-by: Denis Mukhin <dmukhin@xxxxxxxx>
---
Changes since v1:
- made __printk_ratelimit() static to console driver
---
 xen/drivers/char/console.c | 7 ++++---
 xen/include/xen/lib.h      | 2 --
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index 2bdb4d5fb417..af9ed38da553 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -981,7 +981,7 @@ vprintk_common(const char *fmt, va_list args, const char 
*prefix)
     char         *p, *q;
     unsigned long flags;
 
-    /* console_lock can be acquired recursively from __printk_ratelimit(). */
+    /* console_lock can be acquired recursively from do_printk_ratelimit(). */
     local_irq_save(flags);
     rspin_lock(&console_lock);
     state = &this_cpu(state);
@@ -1273,7 +1273,8 @@ void console_end_sync(void)
  * This enforces a rate limit: not more than one kernel message
  * every printk_ratelimit_ms (millisecs).
  */
-int __printk_ratelimit(unsigned int ratelimit_ms, unsigned int ratelimit_burst)
+static int do_printk_ratelimit(unsigned int ratelimit_ms,
+                               unsigned int ratelimit_burst)
 {
     static DEFINE_SPINLOCK(ratelimit_lock);
     static unsigned long toks = 10 * 5 * 1000;
@@ -1327,7 +1328,7 @@ static const unsigned int printk_ratelimit_burst = 10;
 
 int printk_ratelimit(void)
 {
-    return __printk_ratelimit(printk_ratelimit_ms, printk_ratelimit_burst);
+    return do_printk_ratelimit(printk_ratelimit_ms, printk_ratelimit_burst);
 }
 
 /*
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index bb0fd446b484..f516215ca8e4 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -82,8 +82,6 @@ extern void guest_printk(const struct domain *d, const char 
*fmt, ...)
     __attribute__ ((format (printf, 2, 3)));
 extern void noreturn panic(const char *fmt, ...)
     __attribute__ ((format (printf, 1, 2)));
-extern int __printk_ratelimit(unsigned int ratelimit_ms,
-                              unsigned int ratelimit_burst);
 extern int printk_ratelimit(void);
 
 #define gprintk(lvl, fmt, args...) \
-- 
2.52.0




 


Rackspace

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