diff mbox

RFC: [PATCH v1] KVM: Use trace_printk() for vcpu_unimpl() for performance reasons

Message ID ls7vv5$pno$1@ger.gmane.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ilari Stenroth Aug. 10, 2014, 2:35 p.m. UTC
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 mbox

Patch

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, ...)					\