[Devel] [PATCH RHEL10 COMMIT] ve/printk: log rate-limited "callbacks suppressed" messages to correct dmesg

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 1 20:43:53 MSK 2025


The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.21.vz10
------>
commit b36c62d60fa71d92ebf761bc53ea2165c73bb64d
Author: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
Date:   Tue Nov 25 16:40:32 2025 +0000

    ve/printk: log rate-limited "callbacks suppressed" messages to correct dmesg
    
    This patch fixes the behavior of the ve_printk_ratelimited helper so
    that "callback suppressed" messages are printed to the log buffer
    specified when the helper is called.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-119876
    
    Signed-off-by: Aleksei Oladko <aleksey.oladko at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
    
    Feature: printk: per-CT virtualization
---
 include/linux/printk.h          |  2 +-
 include/linux/ratelimit_types.h |  3 +++
 lib/ratelimit.c                 | 10 ++++++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index 8bbf98d43b939..9e784cd58f2a1 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -734,7 +734,7 @@ struct pi_entry {
 				      DEFAULT_RATELIMIT_INTERVAL,	\
 				      DEFAULT_RATELIMIT_BURST);		\
 									\
-	if (__ratelimit(&_rs))						\
+	if (ve_ratelimit(dst, &_rs))					\
 		ve_printk(dst, fmt, ##__VA_ARGS__);			\
 })
 #else
diff --git a/include/linux/ratelimit_types.h b/include/linux/ratelimit_types.h
index 765232ce0b5e9..0c49f5419cdbf 100644
--- a/include/linux/ratelimit_types.h
+++ b/include/linux/ratelimit_types.h
@@ -44,4 +44,7 @@ struct ratelimit_state {
 extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
 #define __ratelimit(state) ___ratelimit(state, __func__)
 
+extern int __ve_ratelimit(int dst, struct ratelimit_state *rs, const char *func);
+#define ve_ratelimit(dst, state) __ve_ratelimit(dst, state, __func__)
+
 #endif /* _LINUX_RATELIMIT_TYPES_H */
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index ce945c17980b9..927e47b4f4d5f 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -24,7 +24,7 @@
  * 0 means callbacks will be suppressed.
  * 1 means go ahead and do it.
  */
-int ___ratelimit(struct ratelimit_state *rs, const char *func)
+int __ve_ratelimit(int dst, struct ratelimit_state *rs, const char *func)
 {
 	/* Paired with WRITE_ONCE() in .proc_handler().
 	 * Changing two values seperately could be inconsistent
@@ -53,7 +53,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
 	if (time_is_before_jiffies(rs->begin + interval)) {
 		if (rs->missed) {
 			if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
-				printk_deferred(KERN_WARNING
+				ve_printk_deferred(dst, KERN_WARNING
 						"%s: %d callbacks suppressed\n",
 						func, rs->missed);
 				rs->missed = 0;
@@ -73,4 +73,10 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
 
 	return ret;
 }
+EXPORT_SYMBOL(__ve_ratelimit);
+
+int ___ratelimit(struct ratelimit_state *rs, const char *func)
+{
+	return __ve_ratelimit(VE0_LOG, rs, func);
+}
 EXPORT_SYMBOL(___ratelimit);


More information about the Devel mailing list