aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-06-13 15:45:42 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-20 05:42:32 -0400
commitf76c710d759250a43976bcfcab6af6ebb94b7dc2 (patch)
treed8df56dbf32ddf547531b5c01ea2102a8d9c0030 /arch/x86/kvm
parent9ef621d3be56e1188300476a8102ff54f7b6793f (diff)
KVM: Use printk_rlimit() instead of reporting emulation failures just once
Emulation failure reports are useful, so allow more than one per the lifetime of the module. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/x86.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5d21bb69d88c..d1db5aa5c7f4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2076,12 +2076,11 @@ int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
2076 2076
2077void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context) 2077void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
2078{ 2078{
2079 static int reported;
2080 u8 opcodes[4]; 2079 u8 opcodes[4];
2081 unsigned long rip = vcpu->arch.rip; 2080 unsigned long rip = vcpu->arch.rip;
2082 unsigned long rip_linear; 2081 unsigned long rip_linear;
2083 2082
2084 if (reported) 2083 if (!printk_ratelimit())
2085 return; 2084 return;
2086 2085
2087 rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS); 2086 rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS);
@@ -2090,7 +2089,6 @@ void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
2090 2089
2091 printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n", 2090 printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n",
2092 context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]); 2091 context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
2093 reported = 1;
2094} 2092}
2095EXPORT_SYMBOL_GPL(kvm_report_emulation_failure); 2093EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);
2096 2094