Re: [RESEND PATCH 01/13] KVM: x86: Relocate MMIO exit stats counting

From: Sean Christopherson
Date: Fri Aug 23 2019 - 10:37:59 EST


On Fri, Aug 23, 2019 at 11:15:18AM +0200, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:
>
> > 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.
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx>
>
> Reviewed-by: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
>
> This, however, makes me wonder why this is handled in x86-specific code
> in the first place, can we just count KVM_EXIT_MMIO exits when handling
> KVM_RUN?

struct kvm_vcpu_stat is arch specific. At a glance, everyone is counting
similar things, but often in slightly different ways. E.g. PowerPC and
ARM count MMIO exits, but PowerPC counts all exits, ARM has separate
counters for in-kernel vs. userspace, and x86 counts only userspace.