[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DDNX3CCBLWXK.3KMVX9AKL162N@ventanamicro.com>
Date: Tue, 21 Oct 2025 12:10:47 +0200
From: Radim Krčmář <rkrcmar@...tanamicro.com>
To: "Hui Min Mina Chou" <minachou@...estech.com>, <anup@...infault.org>,
<atish.patra@...ux.dev>, <pjw@...nel.org>, <palmer@...belt.com>,
<aou@...s.berkeley.edu>, <alex@...ti.fr>
Cc: <kvm@...r.kernel.org>, <kvm-riscv@...ts.infradead.org>,
<linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<tim609@...estech.com>, <ben717@...estech.com>, <az70021@...il.com>,
"linux-riscv" <linux-riscv-bounces@...ts.infradead.org>
Subject: Re: [PATCH v2] RISC-V: KVM: flush VS-stage TLB after VCPU migration
to prevent stale entries
2025-10-21T16:31:05+08:00, Hui Min Mina Chou <minachou@...estech.com>:
> From: Hui Min Mina Chou <minachou@...estech.com>
>
> If multiple VCPUs of the same Guest/VM run on the same Host CPU,
> hfence.vvma only flushes that Host CPU’s VS-stage TLB. Other Host CPUs
> may retain stale VS-stage entries. When a VCPU later migrates to a
> different Host CPU, it can hit these stale GVA to GPA mappings, causing
> unexpected faults in the Guest.
>
> To fix this, kvm_riscv_gstage_vmid_sanitize() is extended to flush both
> G-stage and VS-stage TLBs whenever a VCPU migrates to a different Host CPU.
> This ensures that no stale VS-stage mappings remain after VCPU migration.
>
> Fixes: 92e450507d56 ("RISC-V: KVM: Cleanup stale TLB entries when host CPU changes")
> Signed-off-by: Hui Min Mina Chou <minachou@...estech.com>
> Signed-off-by: Ben Zong-You Xie <ben717@...estech.com>
> ---
The vvma flush is not necessary on implementation that have a single TLB
for the combined mapping, but there is no good way of detecting that,
Reviewed-by: Radim Krčmář <rkrcmar@...tanamicro.com>
Powered by blists - more mailing lists