Re: [PATCH v5 0/9] KVM: selftests: add powerpc support
From: IBM
Date: Tue Oct 06 2026 - 05:28:32 EST
Sean Christopherson <seanjc@xxxxxxxxxx> writes:
> On Mon, Oct 05, 2026, Ritesh Harjani wrote:
> > I think I'd even prefer to take on an #ifdef (to scope it to PPC if necessary)
>> > over open coding TEST_GEN_PROGS_COMMON.
>>
>> Sure, so will add this check for kvm_create_max_vcpus()
>>
>> #ifdef __powerpc64__
>> TEST_REQUIRE(!is_pseries_lpar());
>> #endif
>
> Or maybe to avoid too many ifdefs, something like:
>
> static inline kvm_is_ppc_pseries_lpar(void)
> {
> /*
> * Comment about how this setup has unique limitations and isn't
> * compatible with tests that create many VMs and/or vCPUs.
> */
> #ifdef __powerpc64___
> return !access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK);
> #else
> return false;
> #endif
> }
>
> Probably redundant naming to some extent, but having "ppc" in there would make it
> super obvious it's a PPC-only check.
>
Sure. So I will get this definition added into kvm_util.h header file.
>> Actually I was thinking we may as well use the same check for now for
>> skipping hardware_disable_test on pseries. Because there also we suffer
>> from the same resource limitation. Let me know if that sounds ok to you
>> or do you want us to skip kvm_create_max_vcpus() only for now, since it
>> is part of TEST_GEN_PROGS_COMMON?
>>
>> > LoongArch open coded its full test list
>> > for some reason, and in less than a year it has started missing out on new common
>> > tests.
>> >
>> >> (& maybe few others like vm_types_test) from that in v6.
>> >
>> > What's wrong with VM types test? That one really should Just Work on all
>> > architectures. It doesn't run on LoongArch, but I assume that's
>> > oversight?
>>
>> So the test doesn't fail (it gets skipped). However this cap
>> "KVM_CAP_VM_TYPES" is only supported on x86 and since I was planning to
>> open code all common tests, hence I thought I may as well not add this
>> in the first place.
>
> /facepalm
>
> I completely forgot KVM_CAP_VM_TYPES is x86-only. FWIW, I'd still say use
> TEST_GEN_PROGS_COMMON if possible.
>
>> BTW, based on this discussion, I think I will re-arrange the patches in
>> the following order and send a v7. (The Makefile.kvm changes will only
>> get added after the main patch which adds powerpc support).
>>
>> cfabdb049bd7 2026-10-05 [Ritesh Harjani (IBM)] (HEAD -> feat-ppc-kvm-selftests-new-sean-v7) KVM: selftests: Skip hardware_disable_test on pseries
>> 2b51fab87b95 2026-09-22 [Ritesh Harjani (IBM)] KVM: PPC: selftests: Skip idle-page check when running nested on pseries LPAR
>> f5d1de1be4e9 2026-10-05 [Ritesh Harjani (IBM)] KVM: selftests: Skip kvm_create_max_vcpus on pseries
>> e45ba15cea25 2026-10-03 [Ritesh Harjani (IBM)] KVM: PPC: selftests: Add helper for checking if running nested
>
> Doesn't this one need to come first? Or is this different than pseries LPAR?
>
That is correct. The patches are in the reverse order taken from the
output of: git log --oneline ...
>> 178c9bca0e20 2026-09-22 [Nicholas Piggin] KVM: PPC: selftests: add support for powerpc
>> 22320662e776 2026-09-11 [Ritesh Harjani (IBM)] KVM: selftests: Fix kvm_create_max_vcpus test for powerpc
>
> This should come before "add support for powerpc", and should have a shortlog
That is correct. The patches are in the reverse order taken from the
output of: git log --oneline ...
> more like "Skip max vCPU IDs test on PPC with <whatever is a good description of the SMT cap>"
>
Sure, I will change this to something like:
KVM: selftests: Skip the max vCPU ID test when KVM_CAP_PPC_SMT is set
kvm_create_max_vcpus creates vCPUs from 0..MAX_VCPUS-1, then again
with ids at the top of KVM_CAP_MAX_VCPU_ID.
On PowerPC the vCPU id is not a flat index: it encodes SMT thread plus
core. So on powerpc maximum permitted vCPU ID depends on the VM's SMT
mode and the maximum reported by KVM_CAP_MAX_VCPU_ID exceeds a simple
non-SMT VM's limit.
So, skip that second loop when KVM_CAP_PPC_SMT is non-zero. The cap is
0 on other arches, so they still run it. The 0..MAX_VCPUS pass is
unchanged.
>> 11b5712b213b 2026-09-22 [Ritesh Harjani (IBM)] KVM: selftests: Move memslot_perf_test off the 256M ELF load address
>> 63c900860b5f 2026-09-22 [Ritesh Harjani (IBM)] KVM: selftests: Don't limit LE dirty-bitmap bitops to s390x
>>
>>
>> Please let me know if this sounds ok?
>
> Ya, works for me!
Thanks! Will send v7 shortly with the discussed changes.
-ritesh