[PATCH 0/3] KVM: riscv: Fix hugetlb G-stage block mapping eligibility
Jinyu Tang <[email protected]>
| Newsgroups | org.infradead.lists.kvm-riscv,org.infradead.lists.linux-riscv,org.kernel.vger.kvm,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
RISC-V KVM checks memslot alignment and head/tail coverage before installing THP-backed PMD G-stage block mappings, but the hugetlb path has used the hugetlb VMA size directly. That can be wrong for memslots whose HVA and GPA have different offsets within the target block, or for partial head/tail blocks. Generalize the existing block eligibility helper so it can check a caller-provided target size, use it to select hugetlb mappings with a PUD -> PMD -> PAGE_SIZE fallback, and add a selftest mode that creates a hugetlb memslot with a deliberate HVA/GPA offset mismatch. Jinyu Tang (3): KVM: riscv: Pass the target size to huge G-stage checks KVM: riscv: Check hugetlb block mappings against memslot bounds KVM: selftests: Add a hugetlb memslot alignment test mode arch/riscv/kvm/mmu.c | 53 +++++++++++++++---- .../selftests/kvm/kvm_page_table_test.c | 28 +++++++--- 2 files changed, 65 insertions(+), 16 deletions(-) -- 2.43.0 -- kvm-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kvm-riscv