summaryrefslogtreecommitdiffstats
path: root/drivers/kvm/kvm.h
diff options
context:
space:
mode:
authorRusty Russell2007-08-01 02:48:02 +0200
committerAvi Kivity2007-10-13 10:18:22 +0200
commitf02424785ab83bab8283ad33044284f749c08db8 (patch)
tree020d73469f801e33012702c58233e776381d3008 /drivers/kvm/kvm.h
parentKVM: Remove unneeded kvm_dev_open and kvm_dev_release functions. (diff)
downloadkernel-qcow2-linux-f02424785ab83bab8283ad33044284f749c08db8.tar.gz
kernel-qcow2-linux-f02424785ab83bab8283ad33044284f749c08db8.tar.xz
kernel-qcow2-linux-f02424785ab83bab8283ad33044284f749c08db8.zip
KVM: Add and use pr_unimpl for standard formatting of unimplemented features
All guest-invokable printks should be ratelimited to prevent malicious guests from flooding logs. This is a start. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/kvm.h')
-rw-r--r--drivers/kvm/kvm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index cfda3abff89a..6d258261891e 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -474,6 +474,14 @@ struct kvm_arch_ops {
extern struct kvm_arch_ops *kvm_arch_ops;
+/* The guest did something we don't support. */
+#define pr_unimpl(vcpu, fmt, ...) \
+ do { \
+ if (printk_ratelimit()) \
+ printk(KERN_ERR "kvm: %i: cpu%i " fmt, \
+ current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \
+ } while(0)
+
#define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
#define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)