From: sashiko-bot@kernel.org
To: "Tao Cui" <cui.tao@linux.dev>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 1/4] LoongArch: KVM: Preserve auto-enabled PV features on userspace override
Date: Tue, 02 Jun 2026 02:26:52 +0000 [thread overview]
Message-ID: <20260602022652.B2DBF1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602021819.2373404-2-cui.tao@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The patch unconditionally forces auto-enabled PV features ON, preventing userspace from disabling them, which breaks VM capability negotiation and live migration.
--
commit 2e3dfd10f9606ff82713655e6b87be567a31ec59
Author: Tao Cui <cuitao@kylinos.cn>
LoongArch: KVM: Preserve auto-enabled PV features on userspace override
This commit adds a pv_auto_features field to struct kvm_arch to save the
kernel-default PV features. It then alters kvm_loongarch_cpucfg_set_attr()
to automatically OR these saved features back into the user-provided feature
mask during KVM_SET_DEVICE_ATTR.
> diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
> index e28084c49e682..47a59ce9e5616 100644
> --- a/arch/loongarch/kvm/vcpu.c
> +++ b/arch/loongarch/kvm/vcpu.c
> @@ -1165,6 +1165,13 @@ static int kvm_loongarch_cpucfg_set_attr(struct kvm_vcpu *vcpu,
> if (val & ~valid)
> return -EINVAL;
>
> + /*
> + * Auto-enabled features (e.g. PV TLB flush) that userspace
> + * is not aware of are preserved so that no QEMU changes are
> + * needed for pure kernel-internal optimisations.
> + */
> + val = (val | kvm->arch.pv_auto_features) & valid;
[Severity: High]
Does unconditionally forcing auto-enabled PV features on prevent userspace
from disabling them?
If a VMM configures a VM for migration to an older host that lacks features
like KVM_FEATURE_STEAL_TIME, it will clear the corresponding bits in the
feature mask.
By forcing these features back on even when userspace explicitly omitted
them, could this cause the guest to observe a feature set unsupported on
the migration destination, resulting in migration failures?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602021819.2373404-1-cui.tao@linux.dev?part=1
next prev parent reply other threads:[~2026-06-02 2:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 2:18 [PATCH v3 0/4] LoongArch: KVM: Add PV TLB flush support Tao Cui
2026-06-02 2:18 ` [PATCH v3 1/4] LoongArch: KVM: Preserve auto-enabled PV features on userspace override Tao Cui
2026-06-02 2:26 ` sashiko-bot [this message]
2026-06-02 2:18 ` [PATCH v3 2/4] LoongArch: KVM: Add PV TLB flush support via steal-time shared memory Tao Cui
2026-06-02 2:37 ` sashiko-bot
2026-06-02 2:18 ` [PATCH v3 3/4] LoongArch: KVM: Implement guest-side PV TLB flush Tao Cui
2026-06-02 2:46 ` sashiko-bot
2026-06-02 2:18 ` [PATCH v3 4/4] KVM: selftests: loongarch: Add PV TLB flush performance test Tao Cui
2026-06-02 2:52 ` sashiko-bot
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=20260602022652.B2DBF1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cui.tao@linux.dev \
--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