[PW_SID:1080252] [v4] RISC-V: KVM: Batch stage-2 TLB flushes#1789
[PW_SID:1080252] [v4] RISC-V: KVM: Batch stage-2 TLB flushes#1789linux-riscv-bot wants to merge 2 commits into
Conversation
KVM RISC-V triggers a TLB flush for every single stage-2 PTE modification (unmap or write-protect) now. Although KVM coalesces the hardware IPIs, the software overhead of executing the flush work for every page is large, especially during dirty page tracking. Following the approach used in x86 and arm64, this patch optimizes the MMU logic by making the PTE manipulation functions return a boolean indicating if a leaf PTE was actually changed. The outer MMU functions bubble up this flag to batch the remote TLB flushes. Consequently, the flush operation is executed only once per batch. Moving it outside of the `mmu_lock` also reduces lock contention. Tested with tools/testing/selftests/kvm on a 4-vCPU guest (Host environment: QEMU 10.2.1 RISC-V) 1. demand_paging_test (1GB memory) time ./demand_paging_test -b 1G -v 4 - Total execution time reduced from ~2m39s to ~2m31s 2. dirty_log_perf_test (1GB memory) ./dirty_log_perf_test -b 1G -v 4 - "Clear dirty log time" per iteration dropped significantly from ~3.40s to ~0.18s Reviewed-by: Nutty Liu <nutty.liu@hotmail.com> Signed-off-by: Jinyu Tang <tjytimi@163.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
|
Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes" |
260916a to
4d16ee9
Compare
PR for series 1080252 applied to workflow
Name: [v4] RISC-V: KVM: Batch stage-2 TLB flushes
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1080252
Version: 4