The commit is pushed to "branch-rh10-6.12.0-55.13.1.2.x.vz10-ovz" and will
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-55.13.1.2.10.vz10
------>
commit 15957bbb75c83224e61d7398ca53e3aaaec62f34
Author: Pavel Tikhomirov <[email protected]>
Date: Tue Oct 7 16:50:27 2025 +0800
ve/printk: add ve_dev_printk_emit() helper
This follows the same logic as ve_printk:
1) In VE0 we always print to host-log, independent of dst.
2) In VEX we print to host-log if dst is VE0_LOG and to ve-log if dst is
VE_LOG.
Will use it in next patch in the ve_netdev_printk() helper for printing
network device information.
https://virtuozzo.atlassian.net/browse/VSTOR-106826
Signed-off-by: Pavel Tikhomirov <[email protected]>
Feature: printk: per-CT virtualization
---
drivers/base/core.c | 30 ++++++++++++++++++++++++++++++
include/linux/dev_printk.h | 2 ++
2 files changed, 32 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 048ff98dbdfd8..687ea49661fb3 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -4958,6 +4958,36 @@ int dev_printk_emit(int level, const struct device *dev,
const char *fmt, ...)
}
EXPORT_SYMBOL(dev_printk_emit);
+static int ve_dev_vprintk_emit(int level, const struct device *dev, const char
*fmt,
+ va_list args)
+{
+ struct dev_printk_info dev_info;
+
+ set_dev_info(dev, &dev_info);
+
+ return ve_vprintk_emit(0, level, &dev_info, fmt, args);
+}
+
+int ve_dev_printk_emit(int dst, int level, const struct device *dev, const
char *fmt, ...)
+{
+ va_list args, args2;
+ int r;
+
+ va_start(args, fmt);
+ va_copy(args2, args);
+
+ if (ve_is_super(get_exec_env()) || (dst & VE0_LOG))
+ r = dev_vprintk_emit(level, dev, fmt, args);
+ if (!ve_is_super(get_exec_env()) && (dst & VE_LOG))
+ r = ve_dev_vprintk_emit(level, dev, fmt, args2);
+
+ va_end(args2);
+ va_end(args);
+
+ return r;
+}
+EXPORT_SYMBOL(ve_dev_printk_emit);
+
static void __dev_printk(const char *level, const struct device *dev,
struct va_format *vaf)
{
diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
index ca32b5bb28eb5..f9ab1dc1545be 100644
--- a/include/linux/dev_printk.h
+++ b/include/linux/dev_printk.h
@@ -36,6 +36,8 @@ int dev_vprintk_emit(int level, const struct device *dev,
const char *fmt, va_list args);
__printf(3, 4) __cold
int dev_printk_emit(int level, const struct device *dev, const char *fmt, ...);
+__printf(4, 5) __cold
+int ve_dev_printk_emit(int dst, int level, const struct device *dev, const
char *fmt, ...);
__printf(3, 4) __cold
void _dev_printk(const char *level, const struct device *dev,
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel