public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Ilari Stenroth <ilari.stenroth@gmail.com>
To: kvm@vger.kernel.org
Subject: RFC: [PATCH v1] KVM: Use trace_printk() for vcpu_unimpl() for performance reasons
Date: Sun, 10 Aug 2014 17:35:17 +0300	[thread overview]
Message-ID: <ls7vv5$pno$1@ger.gmane.org> (raw)

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



                 reply	other threads:[~2014-08-10 15:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ls7vv5$pno$1@ger.gmane.org' \
    --to=ilari.stenroth@gmail.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox