mbox series

[0/2] KVM: arm64: user_mem_abort() improvements

Message ID 20200901133357.52640-1-alexandru.elisei@arm.com (mailing list archive)
Headers show
Series KVM: arm64: user_mem_abort() improvements | expand

Message

Alexandru Elisei Sept. 1, 2020, 1:33 p.m. UTC
The first patch is a fix for a bug that I found by code inspection.

The second patch is an enhancement for the way user_mem_abort() handles
hugetlbfs backed VM memory.

Tested on a rockpro64 with 4K pages and hugetlbfs hugepagesz=1G (PUD sized
block mappings).  First test, guest RAM starts at 0x8100 0000
(memslot->base_gfn not aligned to 1GB); second test, guest RAM starts at
0x8000 0000, but is only 512 MB.  In both cases using PUD mappings is not
possible because either the memslot base address is not aligned, or the
mapping would extend beyond the memslot.

Without the changes, user_mem_abort() uses 4K pages to map the guest IPA.
With the patches, user_mem_abort() uses PMD block mappings (2MB) to map the
guest RAM, which means less TLB pressure and fewer stage 2 aborts.

Alexandru Elisei (2):
  KVM: arm64: Update page shift if stage 2 block mapping not supported
  KVM: arm64: Try PMD block mappings if PUD mappings are not supported

 arch/arm64/kvm/mmu.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Comments

Marc Zyngier Sept. 4, 2020, 10:18 a.m. UTC | #1
On Tue, 1 Sep 2020 14:33:55 +0100, Alexandru Elisei wrote:
> The first patch is a fix for a bug that I found by code inspection.
> 
> The second patch is an enhancement for the way user_mem_abort() handles
> hugetlbfs backed VM memory.
> 
> Tested on a rockpro64 with 4K pages and hugetlbfs hugepagesz=1G (PUD sized
> block mappings).  First test, guest RAM starts at 0x8100 0000
> (memslot->base_gfn not aligned to 1GB); second test, guest RAM starts at
> 0x8000 0000, but is only 512 MB.  In both cases using PUD mappings is not
> possible because either the memslot base address is not aligned, or the
> mapping would extend beyond the memslot.
> 
> [...]

Applied to next, thanks!

[1/2] KVM: arm64: Update page shift if stage 2 block mapping not supported
      commit: 7b75cd5128421c673153efb1236705696a1a9812

Cheers,

	M.