Skip to content

[PW_SID:1068634] [v2] RISC-V: KVM: Batch stage-2 remote TLB flushes#1637

Open
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1068634
Open

[PW_SID:1068634] [v2] RISC-V: KVM: Batch stage-2 remote TLB flushes#1637
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1068634

Conversation

@linux-riscv-bot
Copy link

PR for series 1068634 applied to workflow__riscv__fixes

Name: [v2] RISC-V: KVM: Batch stage-2 remote TLB flushes
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1068634
Version: 2

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 4K 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. This change makes
the generic KVM MMU callbacks (e.g., `kvm_unmap_gfn_range()`) actually
effective by returning the true flush requirement rather than `false`.

Consequently, the flush operation is executed only once per batch.
Moving it outside of the `mmu_lock` also reduces lock contention.
For directory pages, we keep the synchronous flush to ensure safety.

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 ~2m33s to ~2m25s
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.02s to ~0.20s

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>
@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 137.45 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1042.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1393.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 28.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] RISC-V: KVM: Batch stage-2 remote TLB flushes"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants