From: Sean Christopherson <seanjc@google.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/2] KVM: selftests: Create one VM with many vCPUs for each major PMU counters test
Date: Tue, 4 Aug 2026 14:21:16 -0700 [thread overview]
Message-ID: <anJXzBxq6fbPuoQC@google.com> (raw)
In-Reply-To: <20260804211300.668C01F000E9@smtp.kernel.org>
On Tue, Aug 04, 2026, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> > + pr_info("Testing arch events, PMU version %u, perf_caps = %lx\n",
> > + pmu_version, perf_capabilities);
> > +
> > + /* Testing arch events requires a vPMU (there are no negative tests). */
> > + if (!pmu_version)
> > + return;
> > +
> > + vm = pmu_vm_create_with_vcpus((NR_INTEL_ARCH_EVENTS + 2) * (ARRAY_SIZE(unavailable_masks) - 1),
> > + guest_test_arch_events, pmu_version,
> > + perf_capabilities, &vcpus);
>
> [Severity: Medium]
> Could this cause the test to assert on hosts with lower vCPU limits?
>
> This calculation requests up to 144 vCPUs per VM ((14 + 2) * (10 - 1)). If the
> host has a KVM_CAP_MAX_VCPUS limit lower than 144 (which is common in nested
> virtualization or lightweight VMs),
No, it's not. Unless userspace overwrites the VM's max vCPUs, KVM x86's *minimum*
value for KVM_CAP_MAX_VCPUS is 1024.
case KVM_CAP_MAX_VCPUS:
r = KVM_MAX_VCPUS;
if (kvm)
r = kvm->max_vcpus;
break;
#ifdef CONFIG_KVM_MAX_NR_VCPUS
#define KVM_MAX_VCPUS CONFIG_KVM_MAX_NR_VCPUS
#else
#define KVM_MAX_VCPUS 1024
#endif
config KVM_MAX_NR_VCPUS
int "Maximum number of vCPUs per KVM guest"
depends on KVM_X86
range 1024 4096
default 4096 if MAXSMP
default 1024
KVM_CAP_NR_VCPUS incorporates the number of CPUs in the system, but that's purely
a "suggestion" for userspace.
case KVM_CAP_NR_VCPUS:
r = min_t(unsigned int, num_online_cpus(), KVM_MAX_VCPUS);
break;
> vm_create_with_vcpus() might fail with a hard assertion.
>
> Should this check against the host limit and either skip via TEST_REQUIRE()
> or batch the creations into smaller groups of vCPUs?
next prev parent reply other threads:[~2026-08-04 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 21:00 [PATCH v3 0/2] KVM: selftests: Reduce PMC test runtime by ~17x Sean Christopherson
2026-08-04 21:00 ` [PATCH v3 1/2] KVM: selftests: Test one random GP counter in PMU arch events testcase Sean Christopherson
2026-08-04 21:00 ` [PATCH v3 2/2] KVM: selftests: Create one VM with many vCPUs for each major PMU counters test Sean Christopherson
2026-08-04 21:12 ` sashiko-bot
2026-08-04 21:21 ` Sean Christopherson [this message]
2026-08-07 16:25 ` [PATCH v3 0/2] KVM: selftests: Reduce PMC test runtime by ~17x Sean Christopherson
2026-08-10 16:36 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anJXzBxq6fbPuoQC@google.com \
--to=seanjc@google.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.