[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aOeLVwXW/sF4NBUJ@atctrx.andestech.com>
Date: Thu, 9 Oct 2025 18:15:51 +0800
From: Ben Zong-You Xie <ben717@...estech.com>
To: Radim Krčmář <rkrcmar@...tanamicro.com>
CC: <anup@...infault.org>, <atish.patra@...ux.dev>, <pjw@...nel.org>,
<palmer@...belt.com>, <aou@...s.berkeley.edu>, <alex@...ti.fr>,
<liujingqi@...xincomputing.com>, <kvm@...r.kernel.org>,
<kvm-riscv@...ts.infradead.org>, <linux-riscv@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <tim609@...estech.com>,
Hui Min Mina Chou
<minachou@...estech.com>,
linux-riscv
<linux-riscv-bounces@...ts.infradead.org>
Subject: Re: [PATCH] RISC-V: KVM: flush VS-stage TLB after VCPU migration to
prevent stale entries
Hi Radim,
Thanks for the review and the detailed comments.
> What RISC-V implementation are you using? (And does the implementation
> have the same memory access performance in V=0 and V=1 modes, even
> though the latter has two levels of TLBs?)
>
The issue is found when validating our new AndesCore AX66.
The address translation performance is the same for U and VU-mode when the uTLB is hit.
> > 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: b79bf2025dbc ("RISC-V: KVM: Rename and move kvm_riscv_local_tlb_sanitize()")
>
> b79bf2025dbc does not change behavior.
> The bug must have been introduced earlier.
>
Will fix the incorrect Fixes tag in the next version.
Thanks for pointing that out, we'll change to the following:
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>
> > ---
> > diff --git a/arch/riscv/kvm/vmid.c b/arch/riscv/kvm/vmid.c
> > @@ -146,4 +146,10 @@ void kvm_riscv_gstage_vmid_sanitize(struct kvm_vcpu *vcpu)
>
> The function is now doing more that sanitizing gstage.
> Maybe we can again call it kvm_riscv_local_tlb_sanitize()?
>
As for the naming, your suggestion makes sense.
We’re also considering whether it should be moved back from vmid.c to tlb.c,
and we’d like to hear other maintainers’ opinions before doing so.
Thanks again for your feedback.
Best regards,
Ben
Powered by blists - more mailing lists