diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-07-31 20:48:02 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-10-13 04:18:22 -0400 |
commit | f02424785ab83bab8283ad33044284f749c08db8 (patch) | |
tree | 020d73469f801e33012702c58233e776381d3008 /drivers/kvm/kvm.h | |
parent | 33830b4f5bdf2bc21d0c10d38beffdce8edcded7 (diff) |
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.h | 8 |
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 { | |||
474 | 474 | ||
475 | extern struct kvm_arch_ops *kvm_arch_ops; | 475 | extern struct kvm_arch_ops *kvm_arch_ops; |
476 | 476 | ||
477 | /* The guest did something we don't support. */ | ||
478 | #define pr_unimpl(vcpu, fmt, ...) \ | ||
479 | do { \ | ||
480 | if (printk_ratelimit()) \ | ||
481 | printk(KERN_ERR "kvm: %i: cpu%i " fmt, \ | ||
482 | current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \ | ||
483 | } while(0) | ||
484 | |||
477 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) | 485 | #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt) |
478 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) | 486 | #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt) |
479 | 487 | ||