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

From: Andrew Jones
Date: Fri Jun 10 2022 - 14:55:48 EST


On Fri, Jun 03, 2022 at 12:41:07AM +0000, 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.
>
> I have not run x86's amx_test due to lack of hardware. I also haven't run
> sev_migration; something is wonky in either the upstream support for INIT_EX
> or in our test machines and I can't get SEV to initialize.
>
> v2:
> - Drop the forced -Werror patch. [Vitaly]
> - Add TEST_REQUIRE to reduce KSFT_SKIP boilerplate.
> - Rebase to kvm/queue, commit 55371f1d0c01.
> - Clean up even more bad copy+paste code (x86 was hiding a lot of crud).
> - Assert that the input to an ioctl() is (likely) the correct struct.
>
> v1: https://lore.kernel.org/all/20220504224914.1654036-1-seanjc@xxxxxxxxxx
>

Hi Sean,

I've completed a thorough skim / review and it looks great to me. Besides
the final patch where I'm wondering about the loss of the type checking
on our ioctl wrappers, I don't think there are any patches where I
wouldn't be happy to add an r-b. So, for the series, except the last patch

Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx>

Thanks,
drew