From: sashiko-bot@kernel.org
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCHv3 5/7] KVM: PPC: Book3S HV nestedv2: reject vCPU ids beyond the PAPR limit
Date: Sun, 01 Nov 2026 15:38:38 +0000 [thread overview]
Message-ID: <sashiko-outbox-192480@kernel.org> (raw)
In-Reply-To: <3b233fa135d54d3ffb569d7febdc1cb8e0ed406a.1793546707.git.ritesh.list@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] KVM: PPC: undeclared KVM_MAX_VCPU_IDS_NESTEDv2 in kvm_arch_vcpu_precreate()
--
commit 6b87f3d0f26a22dc1fab90af1a0540a7a33c6a90
Author: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
KVM: PPC: Book3S HV nestedv2: reject vCPU ids beyond the PAPR limit
This commit adds a check in kvm_arch_vcpu_precreate() to reject vCPU IDs at
or above KVM_MAX_VCPU_IDS_NESTEDv2 with -EINVAL when running on nestedv2,
avoiding failing later in H_GUEST_CREATE_VCPU.
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 9194cf492d1ca..f82d3545b39ad 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -772,6 +772,9 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
>
> int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
> {
> + if (kvmhv_is_nestedv2() && id >= KVM_MAX_VCPU_IDS_NESTEDv2)
> + return -EINVAL;
[Severity: Medium]
Is this commit missing the prerequisite patch referenced in the commit
message?
In arch/powerpc/kvm/powerpc.c, kvm_arch_vcpu_precreate() checks id against
KVM_MAX_VCPU_IDS_NESTEDv2, but KVM_MAX_VCPU_IDS_NESTEDv2 is not defined in
arch/powerpc/include/asm/kvm_host.h:
#define KVM_MAX_VCPU_IDS (MAX_SMT_THREADS * KVM_MAX_VCORES)
or anywhere else in the tree, causing compilation of
arch/powerpc/kvm/powerpc.c to fail when CONFIG_KVM is enabled.
In addition, the commit message notes that the previous patch caps
KVM_CAP_MAX_VCPU_ID at 2048 on nestedv2, yet kvm_vm_ioctl_check_extension()
in arch/powerpc/kvm/powerpc.c still returns KVM_MAX_VCPU_IDS unconditionally:
case KVM_CAP_MAX_VCPU_ID:
r = KVM_MAX_VCPU_IDS;
break;
Should the prerequisite patch defining KVM_MAX_VCPU_IDS_NESTEDv2 and capping
KVM_CAP_MAX_VCPU_ID in kvm_vm_ioctl_check_extension() be applied before this
change?
--
Sashiko AI review · https://sashiko.dev/#/patchset/3b233fa135d54d3ffb569d7febdc1cb8e0ed406a.1793546707.git.ritesh.list@gmail.com?part=1
next prev parent reply other threads:[~2026-11-01 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 15:28 [PATCHv3 0/7] KVM: PPC: Misc fixes and nestedv2 vCPU limit fixes Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 1/7] KVM: PPC: Book3S HV: Read EX_DSISR as a 32-bit field on guest exit Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 2/7] KVM: PPC: Book3S: Don't call __ffs() on an empty pending_exceptions bitmap Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 3/7] KVM: PPC: BookE: " Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 4/7] KVM: PPC: Book3S HV nestedv2: cap max vcpus to PAPR limit Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 5/7] KVM: PPC: Book3S HV nestedv2: reject vCPU ids beyond the " Ritesh Harjani (IBM)
2026-11-01 15:38 ` sashiko-bot [this message]
2026-11-01 15:28 ` [PATCHv3 6/7] KVM: PPC: Book3S HV: Fix error handling during vcore create Ritesh Harjani (IBM)
2026-11-01 15:28 ` [PATCHv3 7/7] KVM: PPC: Book3s: nestedv2: Free the guest state buffers if vcpu create fails Ritesh Harjani (IBM)
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=sashiko-outbox-192480@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=ritesh.list@gmail.com \
--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.