Re: [Sean Christopherson] [PATCH v2 000/144] KVM: selftests: Overhaul APIs, purge VCPU_ID

From: Thomas Huth
Date: Thu Jun 09 2022 - 04:46:20 EST


On 3 Jun 2022 00:41, Sean Christopherson wrote:

Overhaul KVM's selftest APIs to get selftests to a state where adding new
features and writing tests is less painful/disgusting.

Patches 1 fixes a goof in kvm/queue and should be squashed.

I would really, really, really like to get this queued up sooner than
later, or maybe just thrown into a separate selftests-specific branch that
folks can develop against. Rebasing is tedious, frustrating, and time
consuming. And spoiler alert, there's another 42 x86-centric patches
inbound that builds on this series to clean up CPUID related crud...

The primary theme is to stop treating tests like second class citizens.
Stop hiding vcpu, kvm_vm, etc... There's no sensitive data/constructs, and
the encapsulation has led to really, really bad and difficult to maintain
code. E.g. having to pass around the VM just to call a vCPU ioctl(),
arbitrary non-zero vCPU IDs, tests having to care about the vCPU ID in the
first place, etc...

The other theme in the rework is to deduplicate code and try to set us
up for success in the future. E.g. provide macros/helpers instead of
spamming CTRL-C => CTRL-V (see the -1k LoC), structure the VM creation
APIs to build on one another, etc...

The absurd patch count (as opposed to just ridiculous) is due to converting
each test away from using hardcoded vCPU IDs in a separate patch. The vast
majority of those patches probably aren't worth reviewing in depth, the
changes are mostly mechanical in nature.

However, _running_ non-x86 tests (or tests that have unique non-x86
behavior) would be extremely valuable. All patches have been compile tested
on x86, arm, risc-v, and s390, but I've only run the tests on x86. Based on
my track record for the x86+common tests, I will be very, very surprised if
I didn't break any of the non-x86 tests, e.g. pthread_create()'s 'void *'
param tripped me up multiple times.

Hi,

I just checked your series on s390x, and as far as I can see, the tests still work fine with the patches applied. Thus:

Tested-by: Thomas Huth <thuth@xxxxxxxxxx>