Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amit Machhiwal" <amachhiw@linux.ibm.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v8 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl
Date: Fri, 07 Aug 2026 17:34:52 +0000	[thread overview]
Message-ID: <20260807173453.540441F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260807172433.82045-2-amachhiw@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] KVM_CAP_PPC_COMPAT_CAPS is advertised as supported on pSeries HV KVM, but the KVM_PPC_GET_COMPAT_CAPS ioctl backend implementation is missing, leading to unconditional -ENOTTY failure.
--

--- Patch [1]: [PATCH v8 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl ---
commit 3fd26ec35303a5e885f7551c23267fe626ae5e16
Author: Amit Machhiwal <amachhiw@linux.ibm.com>

KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl

This commit introduces the KVM_CAP_PPC_COMPAT_CAPS capability and the
KVM_PPC_GET_COMPAT_CAPS ioctl to expose CPU compatibility modes. It routes
the ioctl to a backend-specific get_compat_caps implementation.

> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 00302399fc37b..2fe4ea0ca4ff1 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -697,6 +697,13 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
[ ... ]
> +#if defined(CONFIG_KVM_BOOK3S_HV_POSSIBLE)
> +	case KVM_CAP_PPC_COMPAT_CAPS:
> +		r = 0;
> +		if (hv_enabled && kvmhv_on_pseries())
> +			r = 1;
> +		break;
> +#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */

[Severity: High]
Since kvm_vm_ioctl_check_extension() advertises this capability as supported
solely based on platform checks, will userspace expect the ioctl to work?

Looking at the ioctl implementation below, it seems to fail if the backend
is missing. Should this capability check also verify that
kvm->arch.kvm_ops->get_compat_caps is implemented so that it doesn't
advertise a capability the kernel cannot fulfill?

[ ... ]
> @@ -2463,6 +2470,77 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
[ ... ]
> +		/* Reserved fields must be zero */
> +		r = -EINVAL;
> +		if (host_caps.flags)
> +			goto out;
> +
> +		r = -ENOTTY;
> +		if (!kvm->arch.kvm_ops->get_compat_caps)
> +			goto out;
> +
> +		r = kvm->arch.kvm_ops->get_compat_caps(&host_caps);
> +		if (r)
> +			goto out;

[Severity: High]
Does this ioctl currently return -ENOTTY on all platforms?

I don't see any backend implementing get_compat_caps in this patch. If
userspace probes KVM_CAP_PPC_COMPAT_CAPS and gets a positive result, won't
it be unexpectedly broken by receiving -ENOTTY when attempting to use the
ioctl?

Would it be safer to introduce the capability advertisement in the same
patch that wires up the actual backend implementation?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260807172433.82045-1-amachhiw@linux.ibm.com?part=1

  reply	other threads:[~2026-08-07 17:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 17:24 [PATCH v8 0/4] KVM: PPC: Expose CPU compatibility modes for nested guests Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl Amit Machhiwal
2026-08-07 17:34   ` sashiko-bot [this message]
2026-08-08  1:00   ` Ritesh Harjani
2026-08-08 15:47     ` Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 2/4] KVM: PPC: Book3S HV: Implement compat CPU capability retrieval for KVM on PowerVM Amit Machhiwal
2026-08-07 17:39   ` sashiko-bot
2026-08-07 17:24 ` [PATCH v8 3/4] KVM: PPC: Book3S HV: Add support for compat CPU capabilities for KVM on PowerNV Amit Machhiwal
2026-08-07 17:24 ` [PATCH v8 4/4] KVM: PPC: Document KVM_PPC_GET_COMPAT_CAPS ioctl Amit Machhiwal
2026-08-07 17:37   ` sashiko-bot
2026-08-08  1:15   ` Ritesh Harjani
2026-08-08 15:54     ` Amit Machhiwal

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=20260807173453.540441F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amachhiw@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox