• Marc Zyngier's avatar
    arm/arm64: KVM: relax the requirements of VMA alignment for THP · 136d737f
    Marc Zyngier authored
    The THP code in KVM/ARM is a bit restrictive in not allowing a THP
    to be used if the VMA is not 2MB aligned. Actually, it is not so much
    the VMA that matters, but the associated memslot:
    
    A process can perfectly mmap a region with no particular alignment
    restriction, and then pass a 2MB aligned address to KVM. In this
    case, KVM will only use this 2MB aligned region, and will ignore
    the range between vma->vm_start and memslot->userspace_addr.
    
    It can also choose to place this memslot at whatever alignment it
    wants in the IPA space. In the end, what matters is the relative
    alignment of the user space and IPA mappings with respect to a
    2M page. They absolutely must be the same if you want to use THP.
    
    Cc: Christoffer Dall <christoffer.dall@linaro.org>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
    136d737f
mmu.c 25.9 KB