virt inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/10293 ---------------------------------------- When Direct TLBI is enabled and a vCPU migrates to another pCPU, stale TLB entries may remain on the old pCPU. Therefore, a local TLBI must be performed on the new pCPU after migration to prevent stale TLB entries from affecting execution. Suggested-by: Yanan Wang <wangyanan55@huawei.com> Signed-off-by: Jinqian Yang <yangjinqian1@huawei.com> --- arch/arm64/kvm/arm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index d0bb33a2b043..98ff9bb60256 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1218,6 +1218,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) kvm_call_hyp(__kvm_flush_cpu_context, mmu); *last_ran = vcpu->vcpu_id; } + +#ifdef CONFIG_KVM_ARM_DIRECT_TLBI + if (smp_load_acquire(&vcpu->kvm->arch.tlbi_directed) && + !vcpu_is_rec(vcpu) && vcpu->arch.last_ran_cpu != cpu) + kvm_tlbi_flush_vmid_nsh(mmu); +#endif vcpu->arch.last_ran_cpu = cpu; vcpu->cpu = cpu; -- 2.33.0