KVM: x86: Relocate MMIO exit stats counting
Move the stat.mmio_exits update into x86_emulate_instruction(). This is both a bug fix, e.g. the current update flows will incorrectly increment mmio_exits on emulation failure, and a preparatory change to set the stage for eliminating EMULATE_DONE and company. Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
5845038c11
commit
bc8a0aafcb
@ -5456,8 +5456,6 @@ emulate:
|
|||||||
case EMULATE_DONE:
|
case EMULATE_DONE:
|
||||||
return 1;
|
return 1;
|
||||||
case EMULATE_USER_EXIT:
|
case EMULATE_USER_EXIT:
|
||||||
++vcpu->stat.mmio_exits;
|
|
||||||
/* fall through */
|
|
||||||
case EMULATE_FAIL:
|
case EMULATE_FAIL:
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
|
@ -5201,7 +5201,6 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
|
|||||||
err = kvm_emulate_instruction(vcpu, 0);
|
err = kvm_emulate_instruction(vcpu, 0);
|
||||||
|
|
||||||
if (err == EMULATE_USER_EXIT) {
|
if (err == EMULATE_USER_EXIT) {
|
||||||
++vcpu->stat.mmio_exits;
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -6703,6 +6703,8 @@ restart:
|
|||||||
}
|
}
|
||||||
r = EMULATE_USER_EXIT;
|
r = EMULATE_USER_EXIT;
|
||||||
} else if (vcpu->mmio_needed) {
|
} else if (vcpu->mmio_needed) {
|
||||||
|
++vcpu->stat.mmio_exits;
|
||||||
|
|
||||||
if (!vcpu->mmio_is_write)
|
if (!vcpu->mmio_is_write)
|
||||||
writeback = false;
|
writeback = false;
|
||||||
r = EMULATE_USER_EXIT;
|
r = EMULATE_USER_EXIT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user