* RFC: [PATCH v1] KVM: Use trace_printk() for vcpu_unimpl() for performance reasons
@ 2014-08-10 14:35 Ilari Stenroth
0 siblings, 0 replies; only message in thread
From: Ilari Stenroth @ 2014-08-10 14:35 UTC (permalink / raw)
To: kvm
vcpu_unimpl() is called to notify for example about unhandled wrmsr
requests made by KVM guests. It used to call printk() but in
certain setups printk() may cause severe performance impact thus
replacing printk() with guaranteed to be buffered trace_printk()
avoids this caveat.
Signed-off-by: Ilari Stenroth <ilari.stenroth@gmail.com>
---
include/linux/kvm_host.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index a4c33b3..b79ce59 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -24,6 +24,8 @@
#include <linux/err.h>
#include <linux/irqflags.h>
#include <linux/context_tracking.h>
+#include <linux/kernel.h>
+#include <linux/kern_levels.h>
#include <asm/signal.h>
#include <linux/kvm.h>
@@ -408,9 +410,15 @@ struct kvm {
pr_info("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__)
#define kvm_debug(fmt, ...) \
pr_debug("kvm [%i]: " fmt, task_pid_nr(current), ## __VA_ARGS__)
+#ifdef CONFIG_TRACING
+#define kvm_pr_unimpl(fmt, ...) \
+ trace_printk(pr_fmt("KERN_ERR kvm [%i]: " fmt), \
+ task_tgid_nr(current), ## __VA_ARGS__)
+#else
#define kvm_pr_unimpl(fmt, ...) \
pr_err_ratelimited("kvm [%i]: " fmt, \
task_tgid_nr(current), ## __VA_ARGS__)
+#endif
/* The guest did something we don't support. */
#define vcpu_unimpl(vcpu, fmt, ...) \
--
2.0.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-10 15:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-10 14:35 RFC: [PATCH v1] KVM: Use trace_printk() for vcpu_unimpl() for performance reasons Ilari Stenroth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox