[PATCH 2/2] KVM: arm64: selftests: Introduce get_set_regs_perf test

Reiji Watanabe reijiw at google.com
Fri Feb 18 20:50:32 PST 2022


Hi Marc,

On Thu, Feb 17, 2022 at 1:12 AM Marc Zyngier <maz at kernel.org> wrote:
>
> On Thu, 17 Feb 2022 04:52:10 +0000,
> Oliver Upton <oupton at google.com> wrote:
> >
> > Hi Reiji,
> >
> > First off, thanks for looking into this! Seems like a very useful thing
> > to test :-)
> >
> > On Wed, Feb 16, 2022 at 07:49:47PM -0800, Reiji Watanabe wrote:
> > > Introduce a simple performance test of KVM_GET_ONE_REG/KVM_SET_ONE_REG
> > > for registers that are returned by KVM_GET_REG_LIST. This is a pseudo
> > > process of saving/restoring registers during live migration, and this
> > > test quantifies the performance of the process.
> > >
> > > Signed-off-by: Reiji Watanabe <reijiw at google.com>
> > > ---
> > >  tools/testing/selftests/kvm/.gitignore        |   1 +
> > >  tools/testing/selftests/kvm/Makefile          |   1 +
> > >  .../selftests/kvm/aarch64/get_set_regs_perf.c | 456 ++++++++++++++++++
> >
>
> [...]
>
> > Would it make sense to test some opt-in capabilities that expose
> > additional registers (PMU, SVE, etc.)?
>
> I think this is important. System registers are usually saved/restored

Yes, I will fix the test to include registers for opt-in features
when supported.

> in groups, and due to the way we walk the sysreg array, timings are
> unlikely to be uniform. Getting a grip on that could help restructure
> the walking if required (either per-group arrays, or maybe a tree
> structure).

The biggest system register table that I know is sys_reg_descs[],
and KVM_SET_ONE_REG/KVM_GET_ONE_REG/emulation code already uses
binary search to find the target entry.  So, the search itself
isn't that bad.  The difference between the min and the max
latency of KVM_GET_ONE_REG for the registers is always around
200nsec on Ampere Altra machine as far as I checked.


> Note that all of this could equally apply to the guest trapping (the
> walk is the same).
>
> And yes, there are a lot of commonalities with get-reg-list, so
> reusing some of the existing infrastructure would be a good thing.

I will look into that.

Thanks,
Reiji



More information about the linux-arm-kernel mailing list