All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tao Cui" <cui.tao@linux.dev>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/4] LoongArch: KVM: Add PV TLB flush support via steal-time shared memory
Date: Tue, 02 Jun 2026 02:37:57 +0000	[thread overview]
Message-ID: <20260602023757.8520A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602021819.2373404-3-cui.tao@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] The KVM_FEATURE_PV_TLB_FLUSH feature is forcefully enabled by default via `pv_auto_features`, bypassing capability negotiation and breaking backward live migration.
--

commit 36054232bc9801e8c8c49df0b88a0802cdab7a98
Author: Tao Cui <cuitao@kylinos.cn>

LoongArch: KVM: Add PV TLB flush support via steal-time shared memory

This commit implements a paravirtualized TLB flush for LoongArch KVM guests
using the steal-time shared memory page. It uses the preempted byte to allow
guests to request a remote TLB flush without sending an IPI when the target
vCPU is preempted.

> diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c
> index 8af874e0b36b2..4be70e4f1279f 100644
> --- a/arch/loongarch/kvm/vm.c
> +++ b/arch/loongarch/kvm/vm.c
[ ... ]
> @@ -54,8 +54,10 @@ static void kvm_vm_init_features(struct kvm *kvm)
>  	if (kvm_pvtime_supported()) {
>  		kvm->arch.pv_features |= BIT(KVM_FEATURE_PREEMPT);
>  		kvm->arch.pv_features |= BIT(KVM_FEATURE_STEAL_TIME);
> +		kvm->arch.pv_features |= BIT(KVM_FEATURE_PV_TLB_FLUSH);
>  		kvm->arch.kvm_features |= BIT(KVM_LOONGARCH_VM_FEAT_PV_PREEMPT);
>  		kvm->arch.kvm_features |= BIT(KVM_LOONGARCH_VM_FEAT_PV_STEALTIME);
> +		kvm->arch.kvm_features |= BIT(KVM_LOONGARCH_VM_FEAT_PV_TLB_FLUSH);
>  	}
>  	kvm->arch.pv_auto_features = kvm->arch.pv_features;
>  }

[Severity: Critical]
Does unconditionally adding KVM_FEATURE_PV_TLB_FLUSH to pv_features here
force the feature on by default, breaking capability negotiation?

Because kvm_vm_init_features() assigns pv_features to pv_auto_features, the
new PV TLB flush feature is included in the auto-enabled set. Looking at
kvm_loongarch_cpucfg_set_attr() in arch/loongarch/kvm/vcpu.c, it forces
auto-enabled features on:

    val = (val | kvm->arch.pv_auto_features) & valid;

Will this cause the source kernel to override userspace if the vmm explicitly
requests the feature to be disabled to maintain live-migration compatibility
with older hosts?

If the guest discovers and uses the feature, but migrates to an older host
that either ignores the requests or rejects the unknown feature flag, could
this result in silent memory corruption or migration failure?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602021819.2373404-1-cui.tao@linux.dev?part=2

  reply	other threads:[~2026-06-02  2:37 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
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 [this message]
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=20260602023757.8520A1F00893@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 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.