]> git.baikalelectronics.ru Git - kernel.git/commit
RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put()
authorAnup Patel <apatel@ventanamicro.com>
Sat, 9 Apr 2022 03:45:33 +0000 (09:15 +0530)
committerAnup Patel <anup@brainfault.org>
Sat, 9 Apr 2022 03:45:33 +0000 (09:15 +0530)
commit87b4cd6afa429d3d36ffec500e631858758d9d71
treef8d6345007c66c77ce957a29a73bdff6a975a15f
parent54332c6d59504a4b8b94f6c0431e2f464f52bb4f
RISC-V: KVM: Don't clear hgatp CSR in kvm_arch_vcpu_put()

We might have RISC-V systems (such as QEMU) where VMID is not part
of the TLB entry tag so these systems will have to flush all TLB
entries upon any change in hgatp.VMID.

Currently, we zero-out hgatp CSR in kvm_arch_vcpu_put() and we
re-program hgatp CSR in kvm_arch_vcpu_load(). For above described
systems, this will flush all TLB entries whenever VCPU exits to
user-space hence reducing performance.

This patch fixes above described performance issue by not clearing
hgatp CSR in kvm_arch_vcpu_put().

Fixes: c5536e067939 ("RISC-V: KVM: Implement VCPU world-switch")
Cc: stable@vger.kernel.org
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
arch/riscv/kvm/vcpu.c