If the KVM side max vcpu number is larger than the one supported by the userspace selftests, adjust the max number. Signed-off-by: Wei Wang <wei.w.wang@xxxxxxxxx> --- tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c index 31b3cb24b9a7..bbdb371e21ed 100644 --- a/tools/testing/selftests/kvm/kvm_create_max_vcpus.c +++ b/tools/testing/selftests/kvm/kvm_create_max_vcpus.c @@ -50,6 +50,13 @@ int main(int argc, char *argv[]) pr_info("KVM_CAP_MAX_VCPU_ID: %d\n", kvm_max_vcpu_id); pr_info("KVM_CAP_MAX_VCPUS: %d\n", kvm_max_vcpus); + pr_info("selftests KVM_MAX_VCPUS: %d\n", KVM_MAX_VCPUS); + + if (kvm_max_vcpu_id > KVM_MAX_VCPUS) + kvm_max_vcpu_id = KVM_MAX_VCPUS; + + if (kvm_max_vcpus > KVM_MAX_VCPUS) + kvm_max_vcpus = KVM_MAX_VCPUS; /* * Check that we're allowed to open nr_fds_wanted file descriptors and -- 2.27.0