Re: [PATCH 13/17] KVM: monolithic: x86: drop the kvm_pmu_ops structure

From: Andrea Arcangeli
Date: Mon Sep 23 2019 - 20:51:58 EST


On Mon, Sep 23, 2019 at 12:21:43PM +0200, Paolo Bonzini wrote:
> On 20/09/19 23:25, Andrea Arcangeli wrote:
> > Cleanup after this was finally left fully unused.
> >
> > Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> > ---
> > arch/x86/include/asm/kvm_host.h | 3 ---
> > arch/x86/kvm/pmu.h | 19 -------------------
> > arch/x86/kvm/pmu_amd.c | 15 ---------------
> > arch/x86/kvm/svm.c | 1 -
> > arch/x86/kvm/vmx/pmu_intel.c | 15 ---------------
> > arch/x86/kvm/vmx/vmx.c | 2 --
> > 6 files changed, 55 deletions(-)
>
> Is there any reason not to do the same for kvm_x86_ops?

This was covered in the commit header of patch 2:

To reduce the rejecting parts while tracking upstream, this doesn't
attempt to entirely remove the kvm_x86_ops structure yet, that is
meant for a later cleanup. The pmu ops have been already cleaned up in
this patchset because it was left completely unused right after the
conversion from pointer to functions to external functions.

Lot more patches are needed to get rid of kvm_x86_ops entirely because
there are lots of places checking the actual value of the method
before making the indirect call. I tried to start that, but then it
got into potentially heavily rejecting territory, so I thought it was
simpler to start with what I had, considering from a performance
standpoint it's optimal already as far as retpolines are concerned.

> (As an aside, patch 2 is not copying over the comments in the struct
> kvm_x86_ops declarations. Granted there aren't many, but we should not
> lose the few that exist).

Yes sorry, this was actually unintentional and the comment need to be
retained in the header declaration.

Thanks,
Andrea