Re: [PATCH v4 20/21] KVM: selftests: Rename vm_get_page_table_entry() to vm_get_pte()

Yosry Ahmed
2026-01-02T17:10:42Z

On Tue, Dec 30, 2025 at 03:01:49PM -0800, Sean Christopherson wrote:
> Shorten the API to get a PTE as the "PTE" acronym is ubiquitous, and the
> "page table entry" makes it unnecessarily difficult to quickly understand
> what callers are doing.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Yosry Ahmed <yosry.ahmed@linux.dev>

> ---
> tools/testing/selftests/kvm/include/x86/processor.h | 2 +-
> tools/testing/selftests/kvm/lib/x86/processor.c | 2 +-
> tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c | 2 +-
> .../selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c | 4 +---
> 4 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h
> index 7b7d962244d6..ab29b1c7ed2d 100644
> --- a/tools/testing/selftests/kvm/include/x86/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86/processor.h
> @@ -1357,7 +1357,7 @@ static inline bool kvm_is_ignore_msrs(void)
> return get_kvm_param_bool("ignore_msrs");
> }
>
> -uint64_t *vm_get_page_table_entry(struct kvm_vm *vm, uint64_t vaddr);
> +uint64_t *vm_get_pte(struct kvm_vm *vm, uint64_t vaddr);
>
> uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint64_t a1, uint64_t a2,
> uint64_t a3);
> diff --git a/tools/testing/selftests/kvm/lib/x86/processor.c b/tools/testing/selftests/kvm/lib/x86/processor.c
> index 5a3385d48902..ab869a98bbdc 100644
> --- a/tools/testing/selftests/kvm/lib/x86/processor.c
> +++ b/tools/testing/selftests/kvm/lib/x86/processor.c
> @@ -390,7 +390,7 @@ static uint64_t *__vm_get_page_table_entry(struct kvm_vm *vm,
> return virt_get_pte(vm, mmu, pte, vaddr, PG_LEVEL_4K);
> }
>
> -uint64_t *vm_get_page_table_entry(struct kvm_vm *vm, uint64_t vaddr)
> +uint64_t *vm_get_pte(struct kvm_vm *vm, uint64_t vaddr)
> {
> int level = PG_LEVEL_4K;
>
> diff --git a/tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c b/tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c
> index a3b7ce155981..c542cc4762b1 100644
> --- a/tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c
> +++ b/tools/testing/selftests/kvm/x86/hyperv_tlb_flush.c
> @@ -619,7 +619,7 @@ int main(int argc, char *argv[])
> */
> gva = vm_vaddr_unused_gap(vm, NTEST_PAGES * PAGE_SIZE, KVM_UTIL_MIN_VADDR);
> for (i = 0; i < NTEST_PAGES; i++) {
> - pte = vm_get_page_table_entry(vm, data->test_pages + i * PAGE_SIZE);
> + pte = vm_get_pte(vm, data->test_pages + i * PAGE_SIZE);
> gpa = addr_hva2gpa(vm, pte);
> virt_pg_map(vm, gva + PAGE_SIZE * i, gpa & PAGE_MASK);
> data->test_pages_pte[i] = gva + (gpa & ~PAGE_MASK);
> diff --git a/tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c b/tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c
> index fabeeaddfb3a..0e8aec568010 100644
> --- a/tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c
> +++ b/tools/testing/selftests/kvm/x86/smaller_maxphyaddr_emulation_test.c
> @@ -47,7 +47,6 @@ int main(int argc, char *argv[])
> struct kvm_vcpu *vcpu;
> struct kvm_vm *vm;
> struct ucall uc;
> - uint64_t *pte;
> uint64_t *hva;
> uint64_t gpa;
> int rc;
> @@ -73,8 +72,7 @@ int main(int argc, char *argv[])
> hva = addr_gpa2hva(vm, MEM_REGION_GPA);
> memset(hva, 0, PAGE_SIZE);
>
> - pte = vm_get_page_table_entry(vm, MEM_REGION_GVA);
> - *pte |= BIT_ULL(MAXPHYADDR);
> + *vm_get_pte(vm, MEM_REGION_GVA) |= BIT_ULL(MAXPHYADDR);
>
> vcpu_run(vcpu);
>
> --
> 2.52.0.351.gbe84eed79e-goog
>