Commit f76c710d authored by Avi Kivity's avatar Avi Kivity

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: default avatarAvi Kivity <avi@qumranet.com>
parent 9ef621d3
...@@ -2076,12 +2076,11 @@ int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value) ...@@ -2076,12 +2076,11 @@ int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value)
void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context) void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
{ {
static int reported;
u8 opcodes[4]; u8 opcodes[4];
unsigned long rip = vcpu->arch.rip; unsigned long rip = vcpu->arch.rip;
unsigned long rip_linear; unsigned long rip_linear;
if (reported) if (!printk_ratelimit())
return; return;
rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS); 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,7 +2089,6 @@ void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context)
printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n", printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n",
context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]); context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
reported = 1;
} }
EXPORT_SYMBOL_GPL(kvm_report_emulation_failure); EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment