Skip to content

[PW_SID:1080252] [v4] RISC-V: KVM: Batch stage-2 TLB flushes#1789

Closed
linux-riscv-bot wants to merge 2 commits into
workflowfrom
pw1080252
Closed

[PW_SID:1080252] [v4] RISC-V: KVM: Batch stage-2 TLB flushes#1789
linux-riscv-bot wants to merge 2 commits into
workflowfrom
pw1080252

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

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

Linux RISC-V bot and others added 2 commits April 17, 2026 16:52
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>
@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v4] RISC-V: KVM: Batch stage-2 TLB flushes"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.28 seconds
Result: WARNING
Output:

CHECK: Alignment should match open parenthesis
#292: FILE: arch/riscv/kvm/mmu.c:588:
+		flush = kvm_riscv_gstage_unmap_range(&gstage, 0UL,
 			kvm_riscv_gstage_gpa_size(kvm->arch.pgd_levels), false);

total: 0 errors, 0 warnings, 1 checks, 240 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit adb36d5b90f6 ("RISC-V: KVM: Batch stage-2 TLB flushes") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 1 checks, 240 lines checked
CHECK: Alignment should match open parenthesis


@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot
Copy link
Copy Markdown
Author

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

@linux-riscv-bot linux-riscv-bot force-pushed the workflow branch 8 times, most recently from 260916a to 4d16ee9 Compare April 19, 2026 22:03
@linux-riscv-bot linux-riscv-bot deleted the pw1080252 branch April 20, 2026 00:06
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