diff options
| author | Ritesh Harjani (IBM) <ritesh.list@gmail.com> | 2026-10-06 15:58:37 +0530 |
|---|---|---|
| committer | Sean Christopherson <seanjc@google.com> | 2026-10-13 12:02:35 -0700 |
| commit | 2bc2c4a8105f3e3bce457cc6446cf3a13e98a827 (patch) | |
| tree | 612c3a1bf60bfc20d217f1b99bba4369af4a4d9b /tools/testing | |
| parent | f51639c0ee7a0ed619a19aac970b3ac07714432b (diff) | |
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.
Suggested-by: Sean Christopherson <seanjc@google.com>
Tested-by: Anushree Mathur <anushree.mathur@linux.ibm.com>
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Reviewed-by: Gautam Menghani <gautam@linux.ibm.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Acked-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/bbfbaa9fb2eca8c92f59dc980546c2587dcfc130.1791280439.git.ritesh.list@gmail.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c index c5310736ed06..1b95027d41ba 100644 --- a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c +++ b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c @@ -58,7 +58,13 @@ int main(int argc, char *argv[]) test_vcpu_creation(0, kvm_max_vcpus); - if (kvm_max_vcpu_id > kvm_max_vcpus) + /* + * Skip the vCPU ID test when running on PowerPC with SMT support, in + * which case system topology is encoded into the vCPU ID and so a VM + * can't use the full advertised vCPU ID range without crafting a valid + * platform specific topology. + */ + if (kvm_max_vcpu_id > kvm_max_vcpus && !kvm_check_cap(KVM_CAP_PPC_SMT)) test_vcpu_creation( kvm_max_vcpu_id - kvm_max_vcpus, kvm_max_vcpus); |
