The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: arm64: Fix stage-2 THP mapping on hosts with 2-level page tables
@ 2026-11-23 10:35 Fuad Tabba
  2026-11-23 10:35 ` [PATCH 1/2] KVM: arm64: Fix THP block mapping when the PMD level is folded Fuad Tabba
  2026-11-23 10:35 ` [PATCH 2/2] KVM: arm64: selftests: Test a THP whose first fault is on a tail page Fuad Tabba
  0 siblings, 2 replies; 3+ messages in thread
From: Fuad Tabba @ 2026-11-23 10:35 UTC (permalink / raw)
  To: Marc Zyngier, Oliver Upton, kvmarm
  Cc: Joey Gouly, Steffen Eiden, Suzuki K Poulose, Zenghui Yu,
	Catalin Marinas, Will Deacon, Gavin Shan, Alexandru Elisei,
	Vincent Donnefort, linux-arm-kernel, linux-kernel, Fuad Tabba

Hi folks,

A fix for how KVM maps a THP at stage-2 on a host with 2-level page
tables (64K pages with a 42-bit VA, or 16K pages with a 36-bit VA).
There, KVM also maps the host memory that follows a THP into the guest
if the guest's first access to the THP isn't to its first page.

transparent_hugepage_adjust() is meant to round the faulting pfn down to
the start of the THP, but its mask is a no-op when the PMD level is
folded, and has been since THP support was added. Before 6f745f1bb5bf2
("KVM: arm64: Convert user_mem_abort() to generic page-table API"), KVM
mapped only the THP anyway, which is why the Fixes: tag is on that
commit. Kernels before f583a53c2b8a ("KVM: arm64: Make fault_ipa
immutable") round the IPA with PMD_MASK, so only the pfn line of the fix
applies there.

Tested on QEMU with a 64K, 42-bit VA host kernel, where the new
selftest scenario fails without the fix and passes with it.

Based on Linux 7.4-rc3 (aebb727447640).

Cheers,
/fuad

Fuad Tabba (2):
  KVM: arm64: Fix THP block mapping when the PMD level is folded
  KVM: arm64: selftests: Test a THP whose first fault is on a tail page

 arch/arm64/kvm/mmu.c                          |  4 +-
 .../kvm/arm64/stage2_block_transitions.c      | 56 ++++++++++++++++++-
 2 files changed, 55 insertions(+), 5 deletions(-)


base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
-- 
2.47.3


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-23 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 10:35 [PATCH 0/2] KVM: arm64: Fix stage-2 THP mapping on hosts with 2-level page tables Fuad Tabba
2026-11-23 10:35 ` [PATCH 1/2] KVM: arm64: Fix THP block mapping when the PMD level is folded Fuad Tabba
2026-11-23 10:35 ` [PATCH 2/2] KVM: arm64: selftests: Test a THP whose first fault is on a tail page Fuad Tabba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox