Re: [PATCH v9 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl

[email protected]
Newsgroups org.kernel.vger.kvm
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Premature advertisement of KVM_CAP_PPC_COMPAT_CAPS causes bisectability breakages.
--

--- Patch [1]: [PATCH v9 1/4] KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl ---
commit 92bc8045e2354b233ee21f84717a2a67b2fadcac
Author: Amit Machhiwal <[email protected]>

KVM: PPC: Introduce KVM_CAP_PPC_COMPAT_CAPS and wire up ioctl

This commit introduces a new capability, KVM_CAP_PPC_COMPAT_CAPS, and an
associated ioctl, KVM_PPC_GET_COMPAT_CAPS. It aims to allow userspace to
discover host processor compatibility modes for nested KVM guests.

> 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)
>  			}
>  		}
>  		break;
> +#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]
Will advertising this capability here break bisectability?

If userspace probes for KVM_CAP_PPC_COMPAT_CAPS, it will be reported as
supported on pSeries. However, since the backend for get_compat_caps isn't
implemented in this commit, the newly added KVM_PPC_GET_COMPAT_CAPS ioctl
will always fail:

[ ... ]

> +		/* 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;

Could this unexpected -ENOTTY failure cause VM initialization in userspace
tools like QEMU to abort when checking this capability during a bisect?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.